什么是我可以使用的功能,基本上与做相反
if(strpos($array['some_key'], $value)!==false) {
that means there's a match and confinue
}
我基本上想遍历两个数组并获取与 in 不匹配的$value
数组$array
。
$array =
Array
(
[0] => GPPZ20
[1] => GPPZ45
[2] => GPPZ75
[3] => GPPZH20
[4] => GPPZH45
)
$codes =
Array
(
[0] => Array
(
[count] => 1
[code] => GPPZH20SWYE4A2VZU
[amount] => 20
)
)
Array
(
[0] => Array
(
[count] => 1
[code] => GPPZH2077434178J6
[amount] => 20
)
)
Array
(
[0] => Array
(
[count] => 17
[code] => PMMC4
[amount] => 25
)
)
Array
(
[0] => Array
(
[count] => 1
[code] => GPPZH2052910M8V62
[amount] => 20
)
)
Array
(
[0] => Array
(
[count] => 1
[code] => GPPZH45B3116LD1VW
[amount] => 45
)
)
所以我想要做的是获取 $codes 数组中 $codes['code'] 值与 $array 值中的任何值都不匹配的所有值。
现在我有那些匹配并通过做抓住那些
foreach($codes as $code) {
foreach($array as $key=>$value) {
if(strpos($code['code'], $value)!==false) {
//it matches grab those values
}
}
}
我现在基本上需要这样的东西来抓住那些不匹配的东西