- end: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
- strtolower: documentation ( source)
<?php
function extension($str){
$str=implode("",explode("\\",$str));
$str=explode(".",$str);
$str=strtolower(end($str));
return $str;
}
// EXAMPLE:
$file='name-Of_soMe.File.txt';
echo extension($file); // txt
?>