3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LargeObject { protected $array; public function __construct() { $this->array = array_fill(0, 2000, 17); } public function getItemProcessor(): Closure { // Try with and without 'static' here return function () { // do some processing unrelated to $this }; } } $start = microtime(true); $processors = []; for ($i = 0; $i < 2000; $i++) { $lo = new LargeObject(); $processors[] = $lo->getItemProcessor(); } $memory = memory_get_usage() >> 20; $time = (microtime(true) - $start) * 1000; printf("This took %dms and %dMB of memory\n", $time, $memory);
Output for git.master, git.master_jit
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 36864 bytes) in /in/QnDuA on line 7 Stack trace: #0 /in/QnDuA(7): array_fill(0, 2000, 17) #1 /in/QnDuA(22): LargeObject->__construct() #2 {main}
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 36864 bytes) in /in/QnDuA on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
18.38 ms | 478 KiB | 5 Q