Получить последнее значение используя PHP explode


$hostname = "http://localhost/test/123.jpg";
$expname = explode ("/", $hostname);
// Point to the last element of array
$lastV =  end($expname);
// Get the current element of array
$lastV =  pos($expname);