3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = "foo"; $stream = fopen('php://memory', 'r+'); fwrite($stream, $data); fseek($stream, 0); if ($data !== fread($stream, strlen($data)+1)) { throw new \Exception("Invalid data"); } if (strlen($data) !== ftell($stream)) { throw new \Exception("Invalid tell"); } if (feof($stream) !== true) { throw new \Exception("Invalid eof"); }

preferences:
58.61 ms | 402 KiB | 5 Q