PHP SplFileInfo :: getPathInfo () function

pathinfo | PHP

Syntax:
SplFileInfo::getPathInfo ($class)
Parameters:This function takes one parameter $class, which is optional. It is used to specify the name of the derived class SplFileInfo.Return Value : This function returns the SplFileInfo object for the parent file path.The following programs illustrate the SplFileInfo function: : getPathInfo().Program 1:  
// PHP program for illustration
// splfileinfo getMTime function $file = new SplFileInfo ( '/ var / www / html / gfg.php' ); $info = $file -> getPathInfo(); print_r ( $info );  
?>
Exit:
SplFileInfo Object ( [pathName: SplFileInfo: private] = > / var / www / html [fileName: SplFileInfo: private] = > html)
Program 2:  
// Use an array to check multiple
// path to files $GFG = array ( "/ home / rajvir / Desktop /GeeksforGeeks/dummy.php", " / home / rajvir / Desktop / gfg.txt " , " / var / www / html / gfg.php " , "dummy.php"); foreach ( $GFG as & amp; $file_name ) { // Create a new SplFile object $file = new SplFileInfo ( $file_name ); // Print the result $info = $file -> getPathInfo(); print_r ( $info ); echo "< / br > " ; }
?>
Exit:
SplFileInfo Object ( [pathName: SplFileInfo: private] = > / home / rajvir / Desktop / GeeksforGeeks [fileName: SplFileInfo: private] = > GeeksforGeeks) SplFileInfo Object ([pathName: SplFileInfo: private] = > / home / rajvir / Desktop fileName: SplFileInfo: private] = > Desktop) SplFileInfo Object ([pathName: SplFileInfo: private] = > / var / www / html [fileName: SplFileInfo: private] = > html) SplFileInfo Object ([pathName: SplFileInfo: private] = >. [fileName: SplFileInfo: private] = >.)
Link: http://php.net/manual/en/splfileinfo.getpathinfo.php



PHP SplFileInfo :: getPathInfo () function: StackOverflow Questions

Get Solution for free from DataCamp guru