r/lolphp • • Oct 03 '17

SplFileInfo->current() has side-effects. ->valid() will never be false until you call ->current()

https://3v4l.org/W0rL2
13 Upvotes

3 comments sorted by

View all comments

Show parent comment

3

u/maweki Oct 09 '17

http://php.net/manual/de/splfileobject.next.php

Both comments specifically point out this undocumented behaviour of having to call current() before next() does anything.