This is a question you can read everywhere on the web with various answers:
$ext = end(explode(\'.\', $filename)); $ext = substr(strrchr($filename, \'.\'), 1
You can try also this (it works on PHP 5.* and 7):
$info = new SplFileInfo('test.zip'); echo $info->getExtension(); // ----- Output -----> zip
Tip: it returns an empty string if the file doesn't have an extension