pathinfo() in PHP enables you to have file extension easily.

$file_part = pathinfo('123.test.php');


Example:

echo $file_part['extension'];
echo $file_part['filename'];


Output:

php 123.test