3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //ini_set('memory_limit', '1M'); register_shutdown_function(function(){ echo "SHUTDOWN"; echo PHP_EOL; $error = error_get_last(); if (isset($error)) { if (0 === strpos($error['message'], 'Allowed memory size')) { // ini_set('memory_limit', -1); w('AFTER ERROR'); } } }); w('FIRST'); function w($a) { echo $a; echo PHP_EOL; $r = 1000000; while($r--) { $m = str_repeat('a', 100000000); echo memory_get_usage() . ":" . rand(1,4) ; echo PHP_EOL; } echo "WHILE ENDS in $a"; echo PHP_EOL; } echo "WORK FINE";
Output for 7.0.0 - 7.1.0
FIRST Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 100000032 bytes) in /in/BKt8W on line 30 SHUTDOWN AFTER ERROR Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 100000032 bytes) in /in/BKt8W on line 30
Process exited with code 255.
Output for hhvm-3.12.0
FIRST 2097152:3 2097152:2 mallctl opt.prof: No such file or directory (2) Fatal error: request has exceeded memory limit in /in/BKt8W on line 28 SHUTDOWN
Process exited with code 255.
Output for hhvm-3.10.0
FIRST 2097152:3 2097152:3 Fatal error: request has exceeded memory limit in /in/BKt8W on line 28 SHUTDOWN
Process exited with code 255.
Output for 5.3.0 - 5.6.28
FIRST Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 100000001 bytes) in /in/BKt8W on line 30 SHUTDOWN AFTER ERROR
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/BKt8W on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/BKt8W on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/BKt8W on line 6
Process exited with code 255.