3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MemoryLeak { public function bad() { $closure = function ($this) {}; $closure([$this]); } public function good1() { $closure = function ($param) {}; $closure([$this]); } public function good2() { $closure = function ($this) {}; $closure($this); } } $object = new MemoryLeak; $usage = 0; ini_set('memory_limit', '10M'); for ($i = 0; $i < 1000000; ++$i) { $object->bad(); } echo "Done" . PHP_EOL;

This is an error 404

There are `0` results


preferences:
134.57 ms | 1436 KiB | 7 Q