3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fileHandle = fopen('php://memory', 'r+'); $string = '<?php class Foo { public function __construct($x) { $this->x = $x; } }'; rewind($fileHandle); fwrite($fileHandle, '$string'); include 'php://memory'; $test = new Foo(5);
based on ptoFj
Output for 7.0.0 - 7.2.6
Fatal error: Uncaught Error: Class 'Foo' not found in /in/AfhMe:11 Stack trace: #0 {main} thrown in /in/AfhMe on line 11
Process exited with code 255.
Output for hhvm-3.15.4
Warning: include(php://memory): File not found in /in/AfhMe on line 9 Fatal error: Uncaught Error: Class undefined: Foo in /in/AfhMe:11 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Class 'Foo' not found in /in/AfhMe on line 11
Process exited with code 255.