Retrieve the key for the current file in FilesystemIterator in PHP
Description
The following code shows how to retrieve the key for the current file in FilesystemIterator.
Example
//from w w w . j a va 2s .c o m
<?php
$iterator = new FilesystemIterator(dirname(__FILE__), FilesystemIterator::KEY_AS_FILENAME);
foreach ($iterator as $fileinfo) {
echo $iterator->key() . "\n";
}
?>
The code above generates the following result.