php数组过滤器

dav*_*lee 0 php arrays filter

嗨,我想在PHP中过滤数组.例如

$a = ARRAY('a', 'b', 'c', 'd', 'e');
$b = ARRAY('c', 'd');
Run Code Online (Sandbox Code Playgroud)

$ a将按数组$ b中的值进行过滤

结果是 ['a', 'b', 'e']

我可以知道如何在PHP中做到这一点?

谢谢.

Gab*_*gra 9

尝试array_diff();

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

问候,加布里埃尔