DirectoryIterator::getPath

(PHP 5, PHP 7)
Get path of current Iterator item without filename
public string DirectoryIterator::getPath ( void )

Get the path to the current DirectoryIterator item.

Returns:

Returns the path to the file, omitting the file name and any trailing slash.

Examples:
DirectoryIterator::getPath() example
1
2
3
4
<?php
$iterator new DirectoryIterator(dirname(__FILE__));
echo $iterator->getPath();
?>

The above example will output something similar to:

/home/examples/public_html
See also:

DirectoryIterator::getBasename() -

DirectoryIterator::getFilename() -

DirectoryIterator::getPathname() -

pathinfo() -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.