开发者

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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜