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 5.4.0 - 5.4.45
memory before: 1814584 memory after: 3357576
Output for 5.3.11 - 5.3.29
memory before: 2219400 memory after: 3762440
Output for 5.3.0 - 5.3.10
memory before: 2219096 memory after: 3762136