How to use Filesystem basename in PHP
In this article I am going to explain about basename function in PHP.
PHP basename() function
The filesystem basename function is used to returns the filename from a path.
Syntax of basename function
Parameters in basename function
It have two parameter:
Parameter |
Description |
path |
It specifies the path to check. |
suffix |
It specifies a file extension. |
Example of filesystem basename function
<html>
<body>
<?php
$path = "C:\wamp\www\Dinesh\mcn.txt";
echo "With file extension:";
echo basename($path) ."<br/>";
echo "Without file extension:";\
echo basename($path,".txt");
?>
</body>
</html>
|
Output:
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here