Q:

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

0

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

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

All Answers

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

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

Sample Output:

index

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