How to use Filesystem dirname in PHP

In this article I am going to explain about dirname function in PHP.
  • 1607

PHP dirname() function

The filesystem dirname function is used to returns directory name component of path.

Syntax of dirname function

dirname(path)

Parameters in dirname function

It has only one parameter:

Parameter Description
path It specifies the file path

Example of filesystem dirname function

<html>

<body>

 

<?php

echo dirname("C:\wamp\www\Dinesh\Mcn.txt");

echo "</br>";

echo dirname("C:\wamp\www\arthmetic.php");

echo "</br>";

echo dirname("D:\sharad\dart-sdk");

?>

 

</body>

</html>


Output:

dirname function.jpg

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

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.