3v4l.org

run code in 300+ PHP versions simultaneously
<?php $handle = fopen('/tmp/file', 'w+'); // truncate + attempt to create fwrite($handle, '12345'); // file position > 0 rewind($handle); // position = 0 $content = stream_get_contents($handle); // file position = 0 in PHP 5.1.6, file position > 0 in PHP 5.2.17! fwrite($handle, '6789'); fclose($handle); echo file_get_contents('/tmp/file');

preferences:
46.42 ms | 402 KiB | 5 Q