//方法1
$str = '/www/htdocs/your_image.jpg';
return end(explode('.', $str));
//方法2
$info = pathinfo($str);
return $info['extension'];