3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); ini_set('display_errors', '0'); register_shutdown_function(function (): void { // error handler consumes non-fatal errors $error = error_get_last(); if($error){ echo "System died.\n"; var_dump($error); } }); set_error_handler(function(...$error){ echo "Error handler.\n"; var_dump($error); }); $f .= ''; // test out of memory $d = str_repeat('f', 100000); foreach (range(1, 100) as $x) { $d = $d . $d; }
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.1, 8.1.28, 8.2.18, 8.3.5 - 8.3.6
Error handler. array(4) { [0]=> int(2) [1]=> string(21) "Undefined variable $f" [2]=> string(9) "/in/cE3Xn" [3]=> int(20) } System died. array(4) { ["type"]=> int(1) ["message"]=> string(82) "Allowed memory size of 67108864 bytes exhausted (tried to allocate 51200032 bytes)" ["file"]=> string(9) "/in/cE3Xn" ["line"]=> int(24) }
Process exited with code 255.
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Error handler. array(4) { [0]=> int(2) [1]=> string(21) "Undefined variable $f" [2]=> string(9) "/in/cE3Xn" [3]=> int(20) } System died. array(4) { ["type"]=> int(1) ["message"]=> string(75) "Out of memory (allocated 16998400 bytes) (tried to allocate 25600032 bytes)" ["file"]=> string(9) "/in/cE3Xn" ["line"]=> int(24) } mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.1.2 - 8.1.27
Error handler. array(4) { [0]=> int(2) [1]=> string(21) "Undefined variable $f" [2]=> string(9) "/in/cE3Xn" [3]=> int(20) } System died. array(4) { ["type"]=> int(1) ["message"]=> string(69) "Out of memory (allocated 16998400) (tried to allocate 25600032 bytes)" ["file"]=> string(9) "/in/cE3Xn" ["line"]=> int(24) } mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Error handler. array(5) { [0]=> int(8) [1]=> string(21) "Undefined variable: f" [2]=> string(9) "/in/cE3Xn" [3]=> int(20) [4]=> array(8) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(0) { } ["_FILES"]=> array(0) { } ["argv"]=> array(1) { [0]=> string(9) "/in/cE3Xn" } ["argc"]=> int(1) ["_SERVER"]=> array(17) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIL"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["HOME"]=> string(4) "/tmp" ["PHP_SELF"]=> string(9) "/in/cE3Xn" ["SCRIPT_NAME"]=> string(9) "/in/cE3Xn" ["SCRIPT_FILENAME"]=> string(9) "/in/cE3Xn" ["PATH_TRANSLATED"]=> string(9) "/in/cE3Xn" ["DOCUMENT_ROOT"]=> string(0) "" ["REQUEST_TIME_FLOAT"]=> float(1660490539.0001) ["REQUEST_TIME"]=> int(1660490539) ["argv"]=> array(1) { [0]=> string(9) "/in/cE3Xn" } ["argc"]=> int(1) } ["f"]=> NULL } } System died. array(4) { ["type"]=> int(1) ["message"]=> string(82) "Allowed memory size of 67108864 bytes exhausted (tried to allocate 51200032 bytes)" ["file"]=> string(9) "/in/cE3Xn" ["line"]=> int(24) }
Process exited with code 255.

preferences:
140.3 ms | 403 KiB | 121 Q