3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $txt = <<< TXT foo bar baz TXT; $file = new SplTempFileObject(-1); $file->fwrite($txt); $file->rewind(); $file->seek(100); echo "{$file->key()} => {$file->current()}";
Output for 5.2.7 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
2 =>
Output for 5.1.4 - 5.2.6

Process exited with code 137.
Output for 5.1.3
Fatal error: Uncaught exception 'RuntimeException' with message 'SplTempFileObject::__construct(php://memory): failed to open stream: Success' in /in/RZL1U:8 Stack trace: #0 /in/RZL1U(8): SplTempFileObject->__construct(-1) #1 {main} thrown in /in/RZL1U on line 8
Process exited with code 255.
Output for 5.1.2
Fatal error: Uncaught exception 'RuntimeException' with message 'SplTempFileObject::__construct(php://memory): failed to open stream: Success' in /in/RZL1U:9 Stack trace: #0 /in/RZL1U(9): SplTempFileObject->__construct(-1) #1 {main} thrown in /in/RZL1U on line 9
Process exited with code 255.
Output for 5.0.0 - 5.1.1
Fatal error: Class 'SplTempFileObject' not found in /in/RZL1U on line 8
Process exited with code 255.
Output for 4.4.3 - 4.4.9
Parse error: syntax error, unexpected '(', expecting '}' in /in/RZL1U on line 13
Process exited with code 255.
Output for 4.4.2
Parse error: syntax error, unexpected '(', expecting '}' in /in/RZL1U on line 14
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '(', expecting '}' in /in/RZL1U on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'}'' in /in/RZL1U on line 13
Process exited with code 255.