Checking the element whether it is in array and getting remaining values of array
I have an array(1,3,5,7,10) and an variable containing value say a=1 Now i want to get the result 开发者_Go百科as array(3,5,7,10) ie. getting the values other than that variable value
array_diff($original_array, array($a));
use array_diff: http://php.net/manual/en/function.array-diff.php
$arr1 = array(1,3,5,7,10)
$a = 1
$arr2 = array_diff($arr1, array($a))
精彩评论