Q:

Write a PHP script to get the characters after the last '/' in an url

0

Write a PHP script to get the characters after the last '/' in an url.

Sample URL : 'http://www.example.com/5478631

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$my_url = 'http://www.example.com/5478631';
echo substr($my_url, strrpos($my_url, '/' )+1)."\n";
?>

Sample Output:

5478631

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now