Strips a filename from path and suffix.
The basename() function returns a filename without the path. If the suffix parameter is provided, that suffix will also be removed.
<?php
$filename = "/var/tmp/phptest.log";
print "$filename<br>";
print basename($filename) . "<br>";
print basename($filename, ".log") . "<br>";
print basename($filename, "test.log");
?> /var/tmp/phptest.log
phptest.log
phptest
phpThis code shows how basename() can be used to modify a filename.