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: 939984
Output for 7.0.0 - 7.0.14
memory before: 939568 memory after: 939936
Output for 5.6.0 - 5.6.28
memory before: 1814160 memory after: 3358008
Output for 5.5.0 - 5.5.36
memory before: 1814112 memory after: 3357752
Output for 5.4.0 - 5.4.45
memory before: 1814584 memory after: 3358224
Output for 5.3.11 - 5.3.29
memory before: 2219400 memory after: 3763272
Output for 5.3.0 - 5.3.10
memory before: 2219096 memory after: 3762968
Output for 5.2.10 - 5.2.17
memory before: 1669000 memory after: 3218200
Output for 5.2.7 - 5.2.9
memory before: 1669080 memory after: 3218200
Output for 5.2.6
memory before: 1669360 memory after: 3218520
Output for 5.2.3 - 5.2.5
memory before: 1572256 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/6u2ZQ 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 71 bytes) in /in/6u2ZQ 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/6u2ZQ on line 4
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/6u2ZQ on line 19
Process exited with code 255.
Output for 4.4.5 - 4.4.9
memory before: Fatal error: Call to undefined function: memory_get_peak_usage() in /in/6u2ZQ on line 19
Process exited with code 255.
Output for 4.3.2 - 4.4.4
memory before: Fatal error: Call to undefined function: memory_get_peak_usage() in /in/6u2ZQ on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1
memory before: Fatal error: Call to undefined function: memory_get_peak_usage() in /in/6u2ZQ on line 19