Iterator::rewind
(PHP 5, PHP 7, PHP 8)
Rewind the Iterator to the first element
Description
Rewinds back to the first element of the Iterator.
This is the first method called when starting a Foreach loop. It will not be executed after Foreach loops.
As Foreach always calls this method before starting iteration, manually advancing the iterator position (for example via SplFileObject::seek) will be reset.
To iterate without rewinding the iterator, wrap it in a NoRewindIterator.
Parameters Parameters
Return Values
Any returned value is ignored.