3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); echo PHP_EOL; set_exception_handler( function () { echo 'set_exception_handler' . PHP_EOL; die(); } ); set_error_handler( function () { echo 'set_error_handler' . PHP_EOL; die(); } ); register_shutdown_function( function () { echo 'register_shutdown_function' . PHP_EOL; if (null === $error = error_get_last()) { return; } echo 'register_shutdown_function WITH exception' . PHP_EOL; throw new ErrorException('!!!'); } ); // set_exception_handler //throw new \Error('qq'); // set_exception_handler //throw new \RuntimeException('qq'); // set_error_handler //$a=b; // register_shutdown_function WITH exception ini_set('memory_limit', '1KB'); $a = []; for ($i = 1; $i <= 10000000; $i++) { $a[] = new stdClass(); }
based on 5EbA5
Output for 7.3.0rc3
Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 262144 bytes) in /in/NhU2A on line 49 register_shutdown_function register_shutdown_function WITH exception Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 262144 bytes) in /in/NhU2A on line 27
Process exited with code 255.
Output for 7.2.0 - 7.3.0rc2
Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 262144 bytes) in /in/NhU2A on line 49 register_shutdown_function register_shutdown_function WITH exception Fatal error: Uncaught ErrorException: !!! in /in/NhU2A:27 Stack trace: #0 [internal function]: {closure}() #1 {main} thrown in /in/NhU2A on line 27
Process exited with code 255.
Output for 7.0.28 - 7.1.23
Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 1052672 bytes) in /in/NhU2A on line 49 register_shutdown_function register_shutdown_function WITH exception Fatal error: Uncaught ErrorException: !!! in /in/NhU2A:27 Stack trace: #0 [internal function]: {closure}() #1 {main} thrown in /in/NhU2A on line 27
Process exited with code 255.
Output for 5.6.38
Warning: Unsupported declare 'strict_types' in /in/NhU2A on line 1 Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 32 bytes) in /in/NhU2A on line 49 register_shutdown_function register_shutdown_function WITH exception Fatal error: Uncaught exception 'ErrorException' with message '!!!' in /in/NhU2A:27 Stack trace: #0 [internal function]: {closure}() #1 {main} thrown in /in/NhU2A on line 27
Process exited with code 255.