3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { public static function &newWithParent(Item &$parent) { $item = new Item(); $item->parent = &$parent; return $item; } private $parent; public function &getParent() { return &$this->parent; } } $item = Item::newWithParent(Item::newWithParent(Item::newWithParent(new Item()))); // Basically it's this now: {"parent":{"parent":{"parent":{"parent":null}}}} // I want to set that null value $list = $item; do { $prev = &$item; $item = $item->getParent(); if ($item->getParent() === null) { $prev =& Item::newWithParent($item); break; } } while (true); var_dump($list);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.150.0180.05612.37
5.4.140.0260.06112.07
5.4.130.0150.04312.04
5.4.120.0180.03912.01
5.4.110.0180.03812.01
5.4.100.0140.04512.01
5.4.90.0170.04112.01
5.4.80.0120.04512.01
5.4.70.0130.04312.00
5.4.60.0160.07112.00
5.4.50.0130.04612.00
5.4.40.0150.04111.99
5.4.30.0150.04211.98
5.4.20.0120.04411.98
5.4.10.0140.04311.99
5.4.00.0140.05611.47
5.3.250.0170.04412.71
5.3.240.0270.06412.72
5.3.230.0180.04312.71
5.3.220.0150.04312.68
5.3.210.0150.04512.68
5.3.200.0190.05612.68
5.3.190.0120.04812.68
5.3.180.0140.04512.67
5.3.170.0140.04612.67
5.3.160.0160.04312.68
5.3.150.0240.06512.67
5.3.140.0200.03912.66
5.3.130.0190.04112.65
5.3.120.0180.04312.65
5.3.110.0130.04612.66
5.3.100.0270.06312.12
5.3.90.0300.08812.09
5.3.80.0150.04412.08
5.3.70.0150.04412.08
5.3.60.0150.04512.07
5.3.50.0160.04312.01
5.3.40.0100.04912.01
5.3.30.0160.04011.97
5.3.20.0250.06211.75
5.3.10.0150.04111.71
5.3.00.0150.04211.70

preferences:
146.27 ms | 1394 KiB | 7 Q