Lets say I have random $variable and three arrays:
$array1 = ("one", "two", "three");
$array2 = ("four", "five", "six");
$array3 = ("seven", "eight", "nine");
How to do this:
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";
I hope you got the point, I would really appreciate any help, I thinking about forearching items in array one by one and then preg_matching them.. But i cant figure out how to do it with more than one array 🙂
you need to use
in_array, see manual here