How to get file extension on PHP?

There are some examples how to get file extensions via PHP.
Example 1. Quick, short, safe

function get_file_extension($file_name) {
return end(explode('.',$file_name));
}

Example 2 [PHP 5 >= 5.3.6]. SPL use

function get_file_extension($file_name) {
$file_info = new SplFileInfo($file_name);
return $file_info->getExtension();
?>

Example 3 [PHP 4 >= 4.0.3+]. Pathinfo use

function get_file_extension($file_name) {
return pathinfo($file_name, PATHINFO_EXTENSION);
?>