How to use Filesystem pathinfo in PHP

In this article I am going to explain about pathinfo function in PHP.
  • 1117

PHP pathinfo() Function

The filesystem pathinfo function returns an array that contains information about a path.

Syntax of pathinfo function     

pathinfo(path, options)

Parameters in pathinfo function

It have two parameter:

Parameter Description
path It specifies path to check.
option It is optional parameter.

Example of filesystem pathinfo function

<html>

<body>
 

<?php

$path_parts = pathinfo("C:\wamp\www\cookie.php");

echo $path_parts['dirname']."</br>";

echo $path_parts['basename']."</br>";

echo $path_parts['extension']."</br>";

echo $path_parts['filename'];

?>
 

</body>

</html>

 

Output:

pathinfo-php-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.