Rewind back to the beginning with FilesystemIterator::rewind in PHP
Description
The following code shows how to rewind back to the beginning with FilesystemIterator::rewind.
Example
//from w ww . j av a 2 s. c o m
<?php
$iterator = new FilesystemIterator(dirname(__FILE__), FilesystemIterator::KEY_AS_FILENAME);
echo $iterator->key() . "\n";
$iterator->next();
echo $iterator->key() . "\n";
$iterator->rewind();
echo $iterator->key() . "\n";
?>
The code above generates the following result.