Use strrpos – same as strpos but in reverse. Find the last occurence of ‘/’ then move forward one position and then substr from that position onwards to the end of the string.
<?php echo substr($url,strrpos($url,'/')+1); ?>
How to get the Filename out of a directory name using PHP