1--TEST-- 2SPL: DirectoryIterator and seek 3--FILE-- 4<?php 5$di = new DirectoryIterator(__DIR__); 6$di->seek(2); 7 8$n = 0; 9while ($di->valid()) { 10 $n++; 11 $di->next(); 12} 13 14echo "With seek(2) we get $n\n"; 15$di->seek(0); 16 17$m = 0; 18while ($di->valid()) { 19 $m++; 20 $di->next(); 21} 22echo "With seek(0) we get $m\n"; 23 24$o = 0; 25$di->rewind(); 26while ($di->valid()) { 27 $o++; 28 $di->next(); 29} 30 31echo "Without seek we get $o\n"; 32 33$p = 0; 34$di->seek($o+1); 35while ($di->valid()) { 36 $p++; 37 $di->next(); 38} 39 40var_dump($n !== $m, $m === $o, $p === 0); 41?> 42===DONE=== 43--EXPECTF-- 44With seek(2) we get %d 45With seek(0) we get %d 46Without seek we get %d 47bool(true) 48bool(true) 49bool(true) 50===DONE=== 51