PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
in php
an image file could have the possible extensions .gif .jpg .jpeg, if im searching for a filename how can i make sure it has one of these extensions?
eg if im searching for the image src in a string containing all of the img tag parameters and the image could be one of these three extensions, how can i make sure it checks for all these variations?
thank you for any help
You could use $array = explode(".", strtolower('FILENAME')) This will give you and array containg each bit of the filename broken up by '.' Then just get the last item in the array $ext = $array[count($array)-1]; Simple way to do it.