Main Contents

Where am I…?

$path = $_SERVER['PHP_SELF'];
$file = basename($path); // $file is set to “index.php”
$file = basename($path, “.php”); // $file is set to “index”

(str path [,str suffix])

path
A path.
n Windows, both slash (/) and backslash (\) are used as directory separator character. In other environments, it is the forward slash (/).
suffix
If the filename ends in suffix this will also be cut off.

Filed under: PHP |

Leave a comment

Login