Is there any standard function in PHP to find only extension of an image from the corresponding file path?
For example ff my image path is like \'/testdir/dir2/image
I think the easy way using strrpos() and substr() methods
strrpos()
substr()
$path = "/testdir/dir2/image.gif"; $ext = substr($path, strrpos($path, '.')+1); echo $ext; // output will be gif
more answers for Another Question related to this Question