3v4l.org

run code in 300+ PHP versions simultaneously
<?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(); }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
set_error_handler register_shutdown_function
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 set_error_handler register_shutdown_function
Output for 7.2.12 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
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.2.11
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.0 - 7.0.33, 7.1.0 - 7.1.33
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.0 - 5.6.40
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.

preferences:
226.91 ms | 402 KiB | 284 Q