+91-943-185-6038 me@shashidharkumar.com

Get a File name from url Using PHP
Get the “filename”, or the last part of the string, with the basename function.


$url = ‘http://www.example.com/feeds/xyz/index.php?filename=abc’;
echo basename($url); // print “index.php”;
Remove a File Extention Using PHP
To strip the file extension from a file name you can use the combination of strrpos() and substr() function like this :
$fileName =”index.php”;
$name = substr($fileName, 0, strrpos($fileName, ‘.’));
echo $name; //print “index”

See also  PHP Tutorial - Part IV