SplFileInfo::getPathInfo

(PHP 5 >= 5.1.2, PHP 7)
Gets an SplFileInfo object for the path
public SplFileInfo SplFileInfo::getPathInfo ([ string $class_name ] )

Gets an SplFileInfo object for the parent of the current file.

Parameters:
class_name

Name of an SplFileInfo derived class to use.

Returns:

Returns an SplFileInfo object for the parent path of the file.

Examples:
SplFileInfo::getPathInfo() example
<?php
$info = new SplFileInfo('/usr/bin/php');
$parent_info = $info->getPathInfo();
var_dump($parent_info->getRealPath());
?>

The above example will output something similar to:

string(8) "/usr/bin"
See also:

SplFileInfo::setInfoClass() -

doc_php
2016-02-24 16:20:14
Comments
Leave a Comment

Please login to continue.