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; } } $usage = 0; $maxima = array(); while (count($maxima) < 5 && $usage < 50000000) { $foo = new Foo(); unset($foo); $last = $usage; $usage = memory_get_usage(); if ($usage < $last) { $maxima[] = $last; } } if (count($maxima)) { printf("Not buggy: Maxima: %s\n", implode('; ', $maxima)); } else { printf("Buggy! Memory never went down."); } ?>
Output for 7.1.0
Not buggy: Maxima: 4631568; 4632776; 4632776; 4632776; 4632776
Output for 7.0.0 - 7.0.14
Not buggy: Maxima: 4631648; 4632800; 4632800; 4632800; 4632800
Output for 5.6.0 - 5.6.28
Not buggy: Maxima: 4726216; 4726456; 4726656; 4726760; 4726880
Output for 5.5.0 - 5.5.37
Not buggy: Maxima: 4726216; 4726440; 4726584; 4726736; 4726888
Output for 5.4.0 - 5.4.45
Not buggy: Maxima: 4726720; 4726944; 4727080; 4727248; 4727376
Output for 5.3.11 - 5.3.29
Not buggy: Maxima: 5130920; 5131752; 5131888; 5132080; 5132184
Output for 5.3.0 - 5.3.10
Not buggy: Maxima: 5130632; 5131472; 5131552; 5131744; 5131904
Output for 5.2.1 - 5.2.17
Buggy! Memory never went down.
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/UZNTc on line 23
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/UZNTc on line 23
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/UZNTc on line 23
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/UZNTc on line 23