(PHP 5, PHP 7)
Get file name as a string
public string DirectoryIterator::__toString ( void )
Get the file name of the current DirectoryIterator item.
Returns:
Returns the file name of the current DirectoryIterator item.
Examples:
A DirectoryIterator::__toString() example
This example will list the contents of the directory containing the script.
<?php $dir = new DirectoryIterator(dirname(__FILE__)); foreach ($dir as $fileinfo) { echo $fileinfo; } ?>
The above example will output something similar to:
. .. apple.jpg banana.jpg index.php pear.jpg
See also:
Please login to continue.