Write a PHP script to get the filename component of the following path

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

Write a PHP script to get the filename component of the following path.

Sample path : "https://www.w3resource.com/index.php"

الأجوبة

<?php
$path = 'www.example.com/public_html/index.php';
$file = basename($path, ".php"); 
echo $file."\n";
?>

Sample Output:

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

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

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