3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; public function __construct(SimpleXmlIterator $xml) { $this->xml = $xml; } public function offsetExists($offset) { return !is_null($this->xml->$offset); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } return new self($this->xml->$offset); } public function offsetSet($offset, $value) { throw new RuntimeException('This is readonly. writing to "' . (string) $offset . '" with value "' . (string) $value . '" not possible'); } public function offsetUnset($offset) { throw new RuntimeException('This is readonly. Unsetting "' . (string) $offset . '" not possible'); } public function getIterator() { return $this->xml; } public function __toString() { return (string) $this->xml; } } $xml = '<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading foo="bar">Reminder</heading> <body>Don\'t forget me this weekend!</body> <recursive> <val>2</val> <val>4</val> </recursive> </note>'; $simple = new SimpleXmlIterator($xml); $xml = new XmlArrayAccessIterator($simple); echo $xml['note']['to']; echo $xml['note']['recursive']['val'][1]; var_dump($simple->me);

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)
8.3.60.0110.00718.93
8.3.50.0140.00822.11
8.3.40.0140.00419.23
8.3.30.0140.00719.09
8.3.20.0050.00319.02
8.3.10.0030.00520.86
8.3.00.0100.00019.29
8.2.180.0040.01816.88
8.2.170.0090.00622.96
8.2.160.0150.00022.46
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00019.95
8.2.110.0070.00321.30
8.2.100.0040.00818.00
8.2.90.0080.00019.55
8.2.80.0060.00318.12
8.2.70.0030.00617.88
8.2.60.0050.00318.18
8.2.50.0000.00818.14
8.2.40.0040.00418.47
8.2.30.0030.00520.11
8.2.20.0070.00017.95
8.2.10.0050.00317.94
8.2.00.0060.00318.13
8.1.280.0090.00625.92
8.1.270.0000.00823.99
8.1.260.0000.00926.35
8.1.250.0000.00828.09
8.1.240.0040.00422.80
8.1.230.0090.00321.15
8.1.220.0050.00318.77
8.1.210.0000.00818.98
8.1.200.0040.00417.48
8.1.190.0080.00017.66
8.1.180.0040.00418.10
8.1.170.0000.00819.03
8.1.160.0030.00619.17
8.1.150.0000.00718.88
8.1.140.0000.00717.69
8.1.130.0000.00717.96
8.1.120.0000.00717.61
8.1.110.0040.00417.68
8.1.100.0080.00017.57
8.1.90.0050.00217.55
8.1.80.0030.00317.58
8.1.70.0030.00317.67
8.1.60.0040.00417.86
8.1.50.0030.00617.66
8.1.40.0030.00517.65
8.1.30.0000.00717.94
8.1.20.0080.00017.78
8.1.10.0040.00417.87
8.1.00.0080.00017.68
8.0.300.0030.00520.15
8.0.290.0000.00716.88
8.0.280.0000.00718.74
8.0.270.0030.00317.49
8.0.260.0030.00317.23
8.0.250.0080.00017.21
8.0.240.0100.00016.95
8.0.230.0030.00517.25
8.0.220.0030.00517.05
8.0.210.0040.00417.04
8.0.200.0000.00717.15
8.0.190.0050.00317.16
8.0.180.0000.00817.10
8.0.170.0000.01117.11
8.0.160.0040.00417.35
8.0.150.0000.00817.09
8.0.140.0060.00317.17
8.0.130.0030.00313.66
8.0.120.0060.00317.19
8.0.110.0040.00417.05
8.0.100.0050.00317.21
8.0.90.0000.00817.08
8.0.80.0060.01117.16
8.0.70.0080.00017.29
8.0.60.0000.00817.28
8.0.50.0040.00417.11
8.0.30.0090.00917.48
8.0.20.0140.00317.40
8.0.10.0040.00417.20
8.0.00.0120.01217.03
7.4.330.0000.00514.98
7.4.320.0000.00616.86
7.4.300.0000.00716.75
7.4.290.0000.00816.79
7.4.280.0030.00516.66
7.4.270.0000.00816.87
7.4.260.0000.00713.61
7.4.250.0080.00016.73
7.4.240.0070.00016.77
7.4.230.0030.00316.93
7.4.220.0150.01116.88
7.4.210.0100.00716.76
7.4.200.0040.00416.82
7.4.190.0000.00716.98
7.4.160.0080.00816.91
7.4.150.0060.01317.40
7.4.140.0140.00617.86
7.4.130.0110.00816.84
7.4.120.0090.01116.77
7.4.110.0090.00916.64
7.4.100.0140.00716.72
7.4.90.0100.00716.57
7.4.80.0130.00319.04
7.4.70.0030.01316.68
7.4.60.0060.00916.77
7.4.50.0040.00016.63
7.4.40.0100.00022.27
7.4.30.0160.00016.84
7.4.00.0070.00915.01
7.3.330.0040.00413.38
7.3.320.0000.00513.54
7.3.310.0000.00716.39
7.3.300.0040.00416.48
7.3.290.0110.00916.62
7.3.280.0060.01016.59
7.3.270.0170.00017.40
7.3.260.0070.01118.24
7.3.250.0120.00616.73
7.3.240.0060.01016.85
7.3.230.0090.00916.61
7.3.210.0150.00616.84
7.3.200.0070.01019.39
7.3.190.0100.00716.75
7.3.180.0060.00916.75
7.3.170.0040.01716.53
7.3.160.0060.01016.87
7.3.120.0090.00815.85
7.3.110.0080.00516.00
7.3.100.0090.00716.08
7.3.90.0080.00615.93
7.3.80.0050.01015.93
7.3.70.0060.00815.95
7.3.60.0030.01215.88
7.3.50.0060.00815.96
7.3.40.0070.00515.76
7.3.30.0050.00915.96
7.3.20.0080.00516.86
7.3.10.0070.00716.80
7.3.00.0030.01016.94
7.2.330.0030.01417.00
7.2.320.0070.01116.68
7.2.310.0120.01216.95
7.2.300.0090.00617.07
7.2.290.0100.00616.63
7.2.250.0070.01014.93
7.2.240.0090.00716.15
7.2.230.0070.01116.11
7.2.220.0070.00916.05
7.2.210.0080.00815.95
7.2.200.0020.01116.13
7.2.190.0030.01115.98
7.2.180.0050.01216.14
7.2.170.0060.00716.05
7.2.160.0030.00616.90
7.2.150.0060.00916.96
7.2.140.0070.01016.90
7.2.130.0040.01116.93
7.2.120.0080.00817.07
7.2.110.0070.00417.07
7.2.100.0070.01017.01
7.2.90.0070.01116.95
7.2.80.0060.01216.94
7.2.70.0090.00616.90
7.2.60.0060.00817.16
7.2.50.0090.00617.16
7.2.40.0030.00917.22
7.2.30.0060.00916.90
7.2.20.0060.00917.10
7.2.10.0100.00316.90
7.2.00.0070.01118.20
7.1.330.0050.01016.32
7.1.320.0080.00516.41
7.1.310.0050.00916.33
7.1.300.0030.01316.46
7.1.290.0090.00716.36
7.1.280.0020.01216.39
7.1.270.0050.01116.37
7.1.260.0050.01116.29
7.1.250.0070.00716.90
7.1.100.0000.01318.29
7.1.70.0080.00817.30
7.1.60.0140.01019.40
7.1.50.0070.00717.00
7.1.00.0030.05722.55
7.0.200.0030.00616.78
7.0.140.0100.06722.17
7.0.60.0000.06321.82
7.0.50.0130.08017.98
7.0.40.0070.08317.88
7.0.30.0130.07717.93
7.0.20.0170.05717.89
7.0.10.0030.05317.82
7.0.00.0070.05017.76
5.6.280.0070.07021.18
5.6.210.0130.04320.67
5.6.200.0130.08318.23
5.6.190.0100.08318.28
5.6.180.0100.07718.19
5.6.170.0070.05718.19
5.6.160.0070.07318.19
5.6.150.0000.09018.22
5.6.140.0100.07718.38
5.6.130.0100.08018.36
5.6.120.0130.07318.29
5.6.110.0000.08718.18
5.6.100.0100.08318.29
5.6.90.0100.04718.38
5.6.80.0030.04017.74
5.6.70.0000.04717.61
5.6.60.0000.04017.67
5.6.50.0130.03017.57
5.6.40.0070.04317.66
5.6.30.0030.03717.76
5.6.20.0000.04017.63
5.6.10.0100.03317.57
5.6.00.0030.04017.63
5.5.350.0030.05020.58
5.5.340.0070.06018.09
5.5.330.0030.06018.15
5.5.320.0100.04718.04
5.5.310.0070.07718.10
5.5.300.0100.08018.02
5.5.290.0030.07718.20
5.5.280.0470.04018.09
5.5.270.0070.08318.12
5.5.260.0030.07718.09
5.5.250.0100.04017.93
5.5.240.0030.03717.41
5.5.230.0000.04017.41
5.5.220.0030.03717.43
5.5.210.0030.03717.37
5.5.200.0030.03717.50
5.5.190.0030.04017.51
5.5.180.0030.04717.47
5.5.160.0070.03317.46
5.5.150.0000.04017.43
5.5.140.0100.03017.38
5.5.130.0100.04017.53
5.5.120.0070.03317.46
5.5.110.0030.03717.52
5.5.100.0000.04317.33
5.5.90.0030.03717.30
5.5.80.0130.03317.30
5.5.70.0030.03717.31
5.5.60.0100.03717.33
5.5.50.0000.04017.30
5.5.40.0100.03017.36
5.5.30.0030.04017.29
5.5.20.0100.04317.23
5.5.10.0030.03717.39
5.5.00.0130.03317.45
5.4.450.0070.08319.44
5.4.440.0070.04719.55
5.4.430.0030.08719.55
5.4.420.0070.08319.38
5.4.410.0030.07319.32
5.4.400.0000.04719.07
5.4.390.0030.04319.23
5.4.380.0030.03719.19
5.4.370.0070.03319.19
5.4.360.0030.03719.21
5.4.350.0030.03719.21
5.4.340.0070.03719.11
5.4.320.0000.05319.35
5.4.310.0000.04019.17
5.4.300.0130.03019.09
5.4.290.0030.03719.34
5.4.280.0000.04018.95
5.4.270.0230.03319.14
5.4.260.0070.03319.17
5.4.250.0000.04019.12
5.4.240.0000.04019.02
5.4.230.0070.03719.34
5.4.220.0070.04719.02
5.4.210.0000.06319.10
5.4.200.0100.05019.18
5.4.190.0070.03318.95
5.4.180.0100.03319.20
5.4.170.0030.04719.13
5.4.160.0030.08319.11
5.4.150.0100.07719.21
5.4.140.0070.07016.49
5.4.130.0100.06316.52
5.4.120.0030.06716.74
5.4.110.0100.06316.66
5.4.100.0130.04016.53
5.4.90.0030.04316.67
5.4.80.0100.03316.66
5.4.70.0030.05016.49
5.4.60.0100.04716.64
5.4.50.0000.04316.50
5.4.40.0070.05016.52
5.4.30.0100.07016.47
5.4.20.0070.07716.50
5.4.10.0100.05716.52
5.4.00.0170.06015.89
5.3.290.0000.04014.80
5.3.280.0000.04014.71
5.3.270.0030.06314.86
5.3.260.0100.07714.78
5.3.250.0070.04314.77
5.3.240.0400.05014.73
5.3.230.0000.05314.73
5.3.220.0230.04014.65
5.3.210.0030.04714.78
5.3.200.0030.07014.82
5.3.190.0070.06014.62
5.3.180.0200.05014.58
5.3.170.0030.04714.83
5.3.160.0270.05014.68
5.3.150.0130.03314.79
5.3.140.0100.03314.60
5.3.130.0130.06314.60
5.3.120.0000.07014.66
5.3.110.0130.07014.74
5.3.100.0030.06714.11
5.3.90.0030.05014.06
5.3.80.0170.06314.27
5.3.70.0070.07314.31
5.3.60.0070.07013.98
5.3.50.0030.06314.20
5.3.40.0100.05014.02
5.3.30.0130.06714.07
5.3.20.0270.04313.95
5.3.10.0100.06713.77
5.3.00.0200.06713.75
5.2.170.0030.05011.29
5.2.160.0030.06011.41
5.2.150.0130.02311.14
5.2.140.0070.05311.26
5.2.130.0070.06311.27
5.2.120.0000.03711.25
5.2.110.0030.05711.09
5.2.100.0030.04711.39
5.2.90.0130.05311.34
5.2.80.0100.06011.23
5.2.70.0000.06711.20
5.2.60.0100.04711.30
5.2.50.0030.06711.27
5.2.40.0030.05311.11
5.2.30.0070.06311.21
5.2.20.0030.05311.22
5.2.10.0070.06310.85
5.2.00.0000.06010.75
5.1.60.0070.04010.14
5.1.50.0030.05310.05
5.1.40.0100.03310.09
5.1.30.0300.02310.47
5.1.20.0000.03710.50
5.1.10.0070.02710.21
5.1.00.0100.05010.16
5.0.50.0100.0278.64
5.0.40.0030.0378.57
5.0.30.0030.0678.34
5.0.20.0070.0408.33
5.0.10.0070.0438.31
5.0.00.0000.0478.32
4.4.90.0030.0337.70
4.4.80.0030.0177.70
4.4.70.0130.0207.70
4.4.60.0000.0377.70
4.4.50.0070.0207.70
4.4.40.0000.0537.70
4.4.30.0000.0277.70
4.4.20.0030.0307.70
4.4.10.0030.0377.70
4.4.00.0030.0437.70
4.3.110.0030.0377.70
4.3.100.0070.0307.70
4.3.90.0030.0377.70
4.3.80.0000.0507.70
4.3.70.0100.0237.70
4.3.60.0000.0407.70
4.3.50.0030.0337.70
4.3.40.0030.0477.70
4.3.30.0030.0177.70
4.3.20.0030.0337.70
4.3.10.0000.0237.70
4.3.00.0100.0237.70

preferences:
41.47 ms | 401 KiB | 5 Q