3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $orig; public function bar() { $this->orig = clone $this; } } $foo = new Foo; $history = []; $last = 0; for ($i = 0; $i < 500; $i++) { $foo->bar(); $peak = round(memory_get_peak_usage(true) / 1024 / 1024, 2); if ($peak != $last) { $history[] = $peak; $last = $peak; } } var_dump($history);
based on 7PRN5