//使用时需注意:方法/函数名称不能重复,如有重复请自行自改
//First
function get_extension($file)
{
$file = explode('.', $file);
return end($file);
}
//Second
function get_extension($file)
{
return substr(strrchr($file, '.'), 1);
}
//Third
function get_extension($file){
return pathinfo($file)['extension'];
}
//Fourth
function get_extension($file)
{
return substr($file, strrpos($file, '.') + 1);
}
//Fifth
function get_extension($file)
{
$file = preg_split('/\./', $file);
return end($file);
}
//Sixth
function get_extension($file){
$file = strrev($file);
return strrev(substr($file,0,strpos($file,'.')));
}
//Seventh
function get_extension($file)
{
return pathinfo($file, PATHINFO_EXTENSION);
}
//Eighth
function get_extension($file)
{
preg_match_all('/\.[a-zA-Z0-9]+/',$file,$data);
return !empty($data[0])?substr(end($data[0]),1):'';
}
//Ninth
function get_extension($file){
return str_replace('.','',strrchr($file,'.'));
}
共 0 条评论