Query: basename
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
BASENAME(3) 1 BASENAME(3) basename - Returns trailing name component of pathSYNOPSISstring basename (string $path, [string $suffix])DESCRIPTIONGiven a string containing the path to a file or directory, this function will return the trailing name component.PARAMETERSo $path - A path. On Windows, both slash ( /) and backslash ( ) are used as directory separator character. In other environments, it is the forward slash ( /). o $suffix - If the name component ends in $suffix this will also be cut off.RETURN VALUESReturns the base name of the given $path.EXAMPLESExample #1 basename(3) example <?php echo "1) ".basename("/etc/sudoers.d", ".d").PHP_EOL; echo "2) ".basename("/etc/sudoers.d").PHP_EOL; echo "3) ".basename("/etc/passwd").PHP_EOL; echo "4) ".basename("/etc/").PHP_EOL; echo "5) ".basename(".").PHP_EOL; echo "6) ".basename("/"); ?> The above example will output: 1) sudoers 2) sudoers.d 3) passwd 4) etc 5) . 6)NOTESNote basename(3) operates naively on the input string, and is not aware of the actual filesystem, or path components such as " ..". Note basename(3) is locale aware, so for it to see the correct basename with multibyte character paths, the matching locale must be set using the setlocale(3) function.SEE ALSOdirname(3), pathinfo(3). PHP Documentation Group BASENAME(3)
Related Man Pages |
---|
basename(3) - linux |
dirname(3) - linux |
dirname(1) - freebsd |
basename(1) - freebsd |
dirname(3) - php |
Similar Topics in the Unix Linux Community |
---|
combine 2 lines (command & echo) |
sudoers file with groups in LDAP |
sudoers |
awk and basename |
Make OS to look for sudoers to different path |