This is a question you can read everywhere on the web with various answers:
$ext = end(explode(\'.\', $filename)); $ext = substr(strrchr($filename, \'.\'), 1
Use substr($path, strrpos($path,'.')+1);. It is the fastest method of all compares.
substr($path, strrpos($path,'.')+1);
@Kurt Zhong already answered.
Let's check the comparative result here: https://eval.in/661574