我想檢查一個數組是否沒有其他值比其他值,但in_array()沒有工作,所以我想它不能用in_array()完成;PHP檢查一個數組是否沒有其他數組比其他值
例如
<?php
$arr1 = array(1,2,3,4,5,6);
$arr2 = array(1,2,9);
if(/*all values in $arr2 are in $arr1*/){
/*return true*/
}
else{
/*return false*/
}
/*this examle should return false*/
?>
或
<?php
$arr1 = array(1,2,3,4,5,6);
$arr2 = array(1,2,6);
if(/*all values in $arr2 are in $arr1*/){
/*return true*/
}
else{
/*return false*/
}
/*this examle should return true*/
?>
我該怎麼辦呢?
有數組功能這樣的失衡:array_merge,和array_diff,array_intersect,等... – 2014-10-03 18:05:35