difference between two array using php -
i having 2 array following ,
$a =array(1,2,3,4); $b =array(1,2,5,6);
here mycode
$c=array_diff($a,$b); $c=array(3,4,5,6);
but want following
$c=array(3,4);
note:
i want $a
array value not present in $b
array.
try
<?php $array1 = array(1,2,3,4); $array2 = array(1,2,5,6); $result = array_diff($array1, $array2); print_r($result); ?>
read php.net array_diff , refer fiddle
Comments
Post a Comment