PHP Basename

the basename() function is used to return a basic file name in a string containing the full path, returning the string successfully, otherwise returning FALSE.


string basename(string path[, string suffix])

The optional parameter suffix represents the suffix of the file. If the suffix suffix is suffix, then this part will also be removed.


Assuming the local access to the file URL address: http://

echo $PHP_SELF; // Output: /html/test.php
echo basename($PHP_SELF); // Output: test.php
echo basename($PHP_SELF, '.php'); // Output: test

Copyright 2014-2017 by All Rights Reserved.