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

  • برمجة بي اتش بي

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

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

الأجوبة

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

Sample Output:

5478631
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...