3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); const LINES = 5; const INDEX = 10; $file = new SplFileObject('/tmp/test.txt', 'w+'); // write to files for ($i = 0; $i < LINES; $i++) { $file->fwrite("line {$i}" . PHP_EOL); } // behaviour of next() $file->rewind(); for ($i = 0; $i < INDEX; $file->next(), $i++); echo 'next(): ', $file->key(), PHP_EOL; // behaviour of seek() $file->rewind(); $file->seek(INDEX); echo 'seek(): ', $file->key(), PHP_EOL;
Output for git.master_jit, git.master, rfc.property-hooks
next(): 10 seek(): 5

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
110.15 ms | 405 KiB | 5 Q