1--TEST-- 2SplFileObject verify interactions between seeking, getting the key and fgets 3--FILE-- 4<?php 5 6$file = new SplTempFileObject(); 7 8for ($i = 0; $i < 100; $i++) { 9 $file->fwrite("Foo $i\n"); 10} 11 12$file->seek(50); 13 14var_dump( 15 ['line' => $file->key(), 'contents' => trim($file->fgets())], 16 ['line' => $file->key(), 'contents' => trim($file->fgets())], 17 ['line' => $file->key(), 'contents' => trim($file->fgets())], 18); 19 20?> 21--EXPECT-- 22array(2) { 23 ["line"]=> 24 int(50) 25 ["contents"]=> 26 string(6) "Foo 50" 27} 28array(2) { 29 ["line"]=> 30 int(51) 31 ["contents"]=> 32 string(6) "Foo 51" 33} 34array(2) { 35 ["line"]=> 36 int(52) 37 ["contents"]=> 38 string(6) "Foo 52" 39} 40