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 do { $item = $item->getParent(); if ($item->getParent() === null) { $item =& new Item(); break; } } while (true); var_dump($item);

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.6.280.0100.06720.87
5.6.210.0100.07720.55
5.6.200.0100.08018.24
5.6.190.0030.09320.46
5.6.180.0300.05320.50
5.6.170.0070.05020.51
5.6.160.0100.07320.39
5.6.150.0100.07718.23
5.6.140.0130.07318.21
5.6.130.0070.08018.16
5.6.120.0100.08021.05
5.6.110.0030.06721.15
5.6.100.0100.08021.00
5.6.90.0030.09021.11
5.6.80.0070.08320.37
5.6.70.4330.03320.44
5.5.350.0070.05020.42
5.5.340.0100.08017.96
5.5.330.0000.07320.31
5.5.320.0530.05720.38
5.5.310.0300.07020.50
5.5.300.0100.04017.93
5.5.290.0030.04017.98
5.5.280.0100.03320.97
5.5.270.0130.05020.80
5.5.260.0130.07720.65
5.5.250.0130.08320.71
5.5.240.0300.07320.26
5.4.450.0800.06719.18
5.4.440.0870.07019.55
5.4.430.0030.07019.47
5.4.420.0700.05019.32
5.4.410.0130.06318.92
5.4.400.0270.06018.76
5.4.390.0370.06718.63
5.4.380.0230.05718.46
5.4.370.0200.04718.73
5.4.360.0070.03718.68
5.4.350.0060.03912.03
5.4.340.0070.04212.02
5.4.320.0100.03212.51
5.4.310.0080.05612.50
5.4.300.0080.05112.51
5.4.290.0070.03812.50
5.4.280.0030.03912.40
5.4.270.0060.03612.40
5.4.260.0050.03912.40
5.4.250.0060.05612.40
5.4.240.0130.04712.40
5.4.230.0070.03612.39
5.4.220.0080.03412.39
5.4.210.0040.03912.39
5.4.200.0040.04012.39
5.4.190.0020.04112.39
5.4.180.0050.03612.39
5.4.170.0130.04512.39
5.4.160.0210.03712.38
5.4.150.0220.05312.37
5.4.140.0120.04612.05
5.4.130.0220.06512.04
5.4.120.0140.04312.00
5.4.110.0140.04411.99
5.4.100.0140.04211.99
5.4.90.0150.04311.99
5.4.80.0270.07611.99
5.4.70.0140.04111.99
5.4.60.0180.03811.98
5.4.50.0140.04411.99
5.4.40.0180.04111.97
5.4.30.0300.07311.97
5.4.20.0140.04311.97
5.4.10.0140.04211.97
5.4.00.0150.04111.46
5.3.290.0110.04912.80
5.3.280.0080.03612.71
5.3.270.0080.03612.72
5.3.260.0100.05012.72
5.3.250.0070.03912.72
5.3.240.0150.04312.72
5.3.230.0180.05912.71
5.3.220.0130.04612.68
5.3.210.0180.04112.68
5.3.200.0170.04312.68
5.3.190.0150.04512.68
5.3.180.0190.04012.67
5.3.170.0130.04512.67
5.3.160.0180.07312.67
5.3.150.0150.04512.68
5.3.140.0210.05212.66
5.3.130.0160.04312.66
5.3.120.0160.04312.66
5.3.110.0130.04612.66
5.3.100.0140.04512.12
5.3.90.0160.04312.09
5.3.80.0190.05612.08
5.3.70.0160.04312.08
5.3.60.0130.04512.07
5.3.50.0170.04112.01
5.3.40.0160.04212.01
5.3.30.0130.04311.98
5.3.20.0200.06811.75
5.3.10.0160.03811.72
5.3.00.0150.04311.70

preferences:
154.25 ms | 1394 KiB | 7 Q