假设我有随机 $variable 和三个数组:
$array1 = ("one", "two", "three");
$array2 = ("four", "five", "six");
$array3 = ("seven", "eight", "nine");
这个怎么做:
if $variable is in $array1
echo "in array one";
elseif $variable is $array2
echo "in array two";
elseif $variable is in $array3
echo "in array three";
else
echo "variable isnt in any of arrays";
我希望你明白这一点,我真的很感激任何帮助,我正在考虑一个一个地搜索数组中的项目,然后 preg_matching 它们。但我不知道如何用多个数组来做到这一点:)