首页| 论坛| 消息
主题:php 在数组中有二个字符串,不在数组中
回帖:$strings = ['apple', 'banana', 'orange', 'grape'];
$toCheck = ['apple', 'banana'];
// 检查 $toCheck 中的所有字符串是否都在 $strings 中
$inArray = array_intersect($strings, $toCheck);
if (count($inArray) === count($toCheck)) {
echo "所有字符串都存在。";
} else {
echo "不是所有字符串都存在。";
}
下一楼›:function checkWuXing($element1, $element2) {
$xiangsheng = ['金' => '水 ..
‹上一楼:$array = ['apple', 'banana', 'orange', 'grape'];
$sear ..

查看全部回帖(3)
«返回主帖