basename
Returns the file name part in the path
basename()
function returns the file name part in the path.
<?php $path = "/testweb/home.php" ; //Show filename with file extension echo basename ( $path ) ; //Show file names without file extension echo basename ( $path , ".php" ) ; ?>
Output:
home.php home
basename ( path , suffix )
parameter | describe |
---|---|
path | Required. Specify the path to be checked. |
suffix | Optional. Specify file extensions. If the file has suffix, this extension will not be output. |