3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { function __construct() { $this->bar = new Bar($this); } } class Bar { function __construct($foo = null) { $this->foo = $foo; } } $i = 1; while ($i < 1000) { $foo = new Foo(); unset($foo); if ($i > 990) { echo number_format(memory_get_usage()) . "\n"; } $i++; }
Output for 7.1.0
1,181,120 1,181,984 1,182,816 1,183,648 1,184,480 1,185,312 1,186,144 1,186,976 1,187,808
Output for 7.0.0 - 7.0.14
1,181,144 1,182,008 1,182,840 1,183,672 1,184,504 1,185,336 1,186,168 1,187,000 1,187,832
Output for hhvm-3.10.0 - 3.12.0
2,097,152 2,097,152 2,097,152 2,097,152 2,097,152 2,097,152 2,097,152 2,097,152 2,097,152
Output for 5.6.0 - 5.6.28
985,632 986,384 987,088 987,792 988,496 989,200 989,904 990,608 991,312
Output for 5.5.0 - 5.5.38
985,600 986,336 987,040 987,744 988,448 989,152 989,856 990,560 991,264
Output for 5.4.0 - 5.4.45
986,104 986,840 987,544 988,248 988,952 989,656 990,360 991,064 991,768
Output for 5.3.11 - 5.3.29
1,389,744 1,390,480 1,391,184 1,391,888 1,392,592 1,393,296 1,394,000 1,394,704 1,395,408
Output for 5.3.0 - 5.3.10
1,389,456 1,390,192 1,390,896 1,391,600 1,392,304 1,393,008 1,393,712 1,394,416 1,395,120
Output for 5.2.10 - 5.2.17
815,416 816,136 816,824 817,512 818,200 818,888 819,576 820,264 820,952
Output for 5.2.7 - 5.2.9
816,648 817,368 818,056 818,744 819,432 820,120 820,808 821,496 822,184
Output for 5.2.3 - 5.2.6
816,920 817,640 818,328 819,016 819,704 820,392 821,080 821,768 822,456
Output for 5.2.2
814,944 815,664 816,352 817,040 817,728 818,416 819,104 819,792 820,480
Output for 5.2.1
814,824 815,544 816,232 816,920 817,608 818,296 818,984 819,672 820,360
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/gYOsH on line 21
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/gYOsH on line 21
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/gYOsH on line 21
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/gYOsH on line 21