开发者

php array filter

Hi i would like to filter array in php. for example

$a = ARRAY('a', 'b', 'c', 'd', 'e');
$b = ARRAY('c', 'd');

$a will be filtered by values in array开发者_开发百科 $b

and result is ['a', 'b', 'e']

may I know how to do it in php?

Thank you.


try array_diff();

http://php.net/manual/en/function.array-diff.php

Regards, Gabriel


$result = array_diff($a, $b)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜