Home Tutorial Php Phpfiles PHP pathinfo() Function and example

 
 

Share on Google+Share on Google+
PHP pathinfo() Function and example
Posted on: October 30, 2009 at 12:00 AM
Advertisement
In this part of the tutorial we will learn about the function pathinfo() in context of file handling. And also we will see the example related to the pathinfo() function

Syntax for PHP pathinfo() Function
Array pathinfo(file_path,other options)

  • pathinfo() function returns the dir, base name, extension, and file name.
  • It returns dir, base name, extension etc in the form of the array of the given file.


PHP pathinfo() Function with Example

Code/Syntax of PHP pathinfo() Function

<?php
    $ar1
=pathinfo("aa.txt");
    foreach
($ar1 as $k=>$v)
       {
      echo
$k."->".$v."<br/>";
       }
?>


Output

dirname->.
basename->aa.txt
extension->txt
filename->aa

Advertisement

Related Tags for PHP pathinfo() Function and example :


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 30, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com