我希望检查一个数组是否只包含允许的元素值(在另一个数组中可用)。
示例:
$allowedElements = array('apple', 'orange', 'pear', 'melon');
checkFunction(array('apple', 'orange'), $allowedElements); // OK
checkFunction(array('pear', 'melon', 'dog'), $allowedElements); // KO invalid array('dog') elements
如何最好地实现checkFunction($a, $b)函数?