3v4l.org

run code in 200+ php & hhvm versions
<?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"); }
Output for 5.3.0 - 5.5.20, 5.6.0 - 5.6.4, hhvm-3.10.1 - 3.22.0, 7.2.0 - 7.2.12
Output for 7.0.0 - 7.1.24
Fatal error: Uncaught Exception: Invalid eof in /in/frnT2:14 Stack trace: #0 {main} thrown in /in/frnT2 on line 14
Process exited with code 255.
Output for 5.5.21 - 5.5.38, 5.6.5 - 5.6.38
Fatal error: Uncaught exception 'Exception' with message 'Invalid eof' in /in/frnT2:14 Stack trace: #0 {main} thrown in /in/frnT2 on line 14
Process exited with code 255.
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 14
Output for 5.1.4 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 14 Fatal error: Uncaught exception 'Exception' with message 'Invalid eof' in /in/frnT2:14 Stack trace: #0 {main} thrown in /in/frnT2 on line 14
Process exited with code 255.
Output for 5.0.0 - 5.0.2, 5.0.5 - 5.1.3
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 14 Warning: fopen(php://memory): failed to open stream: Success in /in/frnT2 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/frnT2 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/frnT2 on line 6 Warning: fread(): supplied argument is not a valid stream resource in /in/frnT2 on line 7 Fatal error: Uncaught exception 'Exception' with message 'Invalid data' in /in/frnT2:8 Stack trace: #0 {main} thrown in /in/frnT2 on line 8
Process exited with code 255.
Output for 5.0.3 - 5.0.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/frnT2 on line 14 Warning: fopen(php://memory): failed to open stream: Success in /in/frnT2 on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in /in/frnT2 on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/frnT2 on line 6 Warning: fread(): supplied argument is not a valid stream resource in /in/frnT2 on line 7 Fatal error: Uncaught exception 'Exception' with message 'Invalid data' in /in/frnT2:8 Stack trace: #0 /in/frnT2(8): unknown() #1 {main} thrown in /in/frnT2 on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/frnT2 on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_NEW in /in/frnT2 on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/frnT2 on line 8
Process exited with code 255.