<?php
$url="http://localhost/user/order.php";
function get_ext1($url){
return substr(strrchr($url,"."),1);
}
function get_ext2($url){
$p=pathinfo($url);//Array ( [dirname] => http://localhost/user [basename] => order.php [extension] => php [filename] => order )
return $p['extension'];
}
function get_ext3($url){
return substr($url,strrpos($url,'.')+1);
}
function get_ext4($url){
$arr=explode('.',$url);
return array_pop($arr);
}
function get_ext5($url){
return pathinfo($url,PATHINFO_EXTENSION);
}
echo get_ext1($url).'<br/>';
echo get_ext2($url).'<br/>';
echo get_ext3($url).'<br/>';
echo get_ext4($url).'<br/>';
echo get_ext5($url).'<br/>';