Write a PHP script to extract the file name from the following string

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

Write a PHP script to extract the file name from the following string.

Sample String : 'www.example.com/public_html/index.php'

Pictorial Presentation:

الأجوبة

<?php
$path = 'www.example.com/public_html/index.php';
$file_name = substr(strrchr($path, "/"), 1);
echo $file_name."\n"; // "index.php"
?>

Sample Output:

index.php
هل كان المحتوى مفيد؟

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

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