Hello,
I'm trying to compare a variable with a content from a defined array. I know I can use $secondarray[0] format to extract the array content, but that's not comfortable since it means I've to do multiple comparisons. For example like these codes below:
$firstarrary = array ('variable taken from outside');
foreach ($firstarray as $firstarraycontent) {
$secondarray = array ('page1', 'page2','page3','page4','page5');
if ($firstarraycontent == $secondarray[any of the secondarray content]) { // How to do this effectively?
echo "There is a match";
} else {
echo "There isn't a match";
}
}
Any help is greatly appreciated. Thank you.