3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function create() { $a = new stdClass(); $b = new stdClass(); $b->a = $a; // $b->cb = function() use ($a) { // }; $a->b = $b; return $a; } echo number_format(memory_get_peak_usage() / 1000000, 2, '.', ' '), " MB\n"; for ($i = 0; $i < 1000; ++$i) { create(); // $a->b = new ArrayObject(); } gc_collect_cycles(); echo number_format(memory_get_peak_usage() / 1000000, 2, '.', ' '), " MB\n";
based on kuLmD
Output for 7.0.0 - 7.1.0
0.38 MB 1.19 MB
Output for hhvm-3.10.0 - 3.12.0
2.10 MB 2.10 MB
Output for 5.4.0 - 5.6.28
0.23 MB 0.99 MB
Output for 5.3.11 - 5.3.29
0.64 MB 1.40 MB
Output for 5.3.0 - 5.3.10
0.63 MB 1.40 MB
Output for 5.2.1 - 5.2.17
0.09 MB Fatal error: Call to undefined function gc_collect_cycles() in /in/LVfuv on line 19
Process exited with code 255.
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_peak_usage() in /in/LVfuv on line 13
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_peak_usage() in /in/LVfuv on line 13
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_peak_usage() in /in/LVfuv on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_peak_usage() in /in/LVfuv on line 13