Hey guys,
I was wondering if it is possible to find a string in an array. Such as this:
PHP Code:
$imgFileExt = array(".png",".jpg",".jpeg",".svg",".ico",".gif");//array full of image file extensions $imgCheck = array_values($imgFileExt);//get the array's values if (preg_match("/$imgCheck/i", $fileTR)) { //checks if there's a match with the array values and the file to read echo "This file is an image";//if there is, tell the user it's an image }
Basically I want to find if the file ($fileTR) contains '.png','gif','jpeg'.......etc. But it's not working
What am I doing wrong?
Thanks
-PG
Last edited by Physicsguy; 07-02-2010 at 01:10 PM..
|