On Windows, both slash (
/) and backslash
\) are used as directory separator character. In
other environments, it is the forward slash (
If the filename ends in suffix this will also be cut off.
$path = "/home/httpd/html/index.php";
$file = basename($path); // $file is set to "index.php"
$file = basename($path, ".php"); // $file is set to "index"