- var_dump: documentation ( source)
<?php
$file = new \SplTempFileObject();
for ($i = 0; $i < 100; $i++) {
$file->fwrite("Foo\t$i\n");
}
// Puts the internal pointer at the start of line index 50 (0-based indexing)
$file->seek(50);
// Read the internal pointer value = 50
var_dump($file->key());
// Read the next available line (which is line at index 50)
var_dump($file->fgets());
// Read the internal pointer value = 50 (end of the line now)
var_dump($file->key());
// Read the next available line (which is line at index 51 as there's nothing more on line 50)
var_dump($file->fgets());
// Read the internal pointer value = 51 (end of the line)
var_dump($file->key());