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; } ); // 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.0 - 7.2.33, 7.3.16 - 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/5EbA5 on line 47 register_shutdown_function register_shutdown_function WITH exception
Process exited with code 255.
Output for 7.1.0 - 7.1.23
Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 1052672 bytes) in /in/5EbA5 on line 47 register_shutdown_function register_shutdown_function WITH exception
Process exited with code 255.
Output for 5.6.38
Warning: Unsupported declare 'strict_types' in /in/5EbA5 on line 1 Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 72 bytes) in /in/5EbA5 on line 47 register_shutdown_function register_shutdown_function WITH exception
Process exited with code 255.

preferences:
188.44 ms | 401 KiB | 173 Q