Here’s my search array:
$aExt = array('png','jpg','gif');
I want to search through the variable:
$sIcon
How can I search if the variable includes anything in this array using PHP?
It’s like in inverted in_array:
strstr($sIcon, $aExt) <- Can second arg be an array?
You can use foreach to iterate over the elements in the array and then use strpos to see if the key is in the content of the variable:
Looking at the names of your variables I think you’re trying to figure out the extension of a file name. You can easily find out the extension of a file using the following:
In your case: