3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function recurse_array(&$in) { if (is_array($in)) { foreach ($in as &$val) { recurse_array($val); } } } $array = range(1, 1000); $array[1000] = $array; $array[1000][1000] = $array; $array[1000][1000][1000] = $array; $array[1000][1000][1000][1000] = $array; $array[1000][1000][1000][1000][1000] = $array; echo 'memory before: ', memory_get_peak_usage(), "\n"; recurse_array($array); echo 'memory after: ', memory_get_peak_usage();
Output for 7.1.0
memory before: 939616 memory after: 1323960
Output for 7.0.0 - 7.0.14
memory before: 939568 memory after: 1323912
Output for 5.6.8 - 5.6.28
memory before: 1814160 memory after: 2630688
Output for 5.5.24 - 5.5.35
memory before: 1814112 memory after: 2630640
Output for 5.4.0 - 5.4.45
memory before: 1814584 memory after: 2631184
Output for 5.3.11 - 5.3.29
memory before: 2219400 memory after: 3035928
Output for 5.3.0 - 5.3.10
memory before: 2219096 memory after: 3035696
Output for 5.2.10 - 5.2.17
memory before: 1669000 memory after: 2371920
Output for 5.2.7 - 5.2.9
memory before: 1669080 memory after: 2371960
Output for 5.2.6
memory before: 1669360 memory after: 2372176
Output for 5.2.3 - 5.2.5
memory before: 1572256 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/VBMuj on line 4
Process exited with code 255.
Output for 5.2.2
memory before: 1570104 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/VBMuj on line 4
Process exited with code 255.
Output for 5.2.1
memory before: 1569632 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/VBMuj on line 5
Process exited with code 255.
Output for 5.0.0 - 5.2.0
memory before: Fatal error: Call to undefined function memory_get_peak_usage() in /in/VBMuj on line 19
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/VBMuj on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/VBMuj on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/VBMuj on line 5
Process exited with code 255.