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($xml['note']['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.0040.01218.55
8.3.50.0120.00722.16
8.3.40.0090.00919.22
8.3.30.0130.00619.10
8.3.20.0000.00819.10
8.3.10.0040.00421.34
8.3.00.0080.00022.02
8.2.180.0130.00318.66
8.2.170.0060.00922.96
8.2.160.0130.00320.61
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00421.19
8.2.110.0030.00722.33
8.2.100.0000.01217.97
8.2.90.0030.00617.88
8.2.80.0060.00318.98
8.2.70.0040.00417.75
8.2.60.0030.00618.29
8.2.50.0080.00018.07
8.2.40.0040.00418.41
8.2.30.0030.00719.67
8.2.20.0080.00018.02
8.2.10.0030.00618.07
8.2.00.0000.00917.98
8.1.280.0110.00625.92
8.1.270.0000.00723.99
8.1.260.0120.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00324.08
8.1.230.0070.00419.27
8.1.220.0000.00817.91
8.1.210.0030.00518.77
8.1.200.0060.00317.60
8.1.190.0040.00417.66
8.1.180.0080.00018.10
8.1.170.0060.00318.76
8.1.160.0050.00219.02
8.1.150.0030.00718.86
8.1.140.0030.00517.66
8.1.130.0030.00317.99
8.1.120.0000.00817.62
8.1.110.0080.00017.68
8.1.100.0070.00017.72
8.1.90.0040.00417.77
8.1.80.0040.00417.53
8.1.70.0000.00717.75
8.1.60.0040.00417.84
8.1.50.0060.00317.66
8.1.40.0030.00617.79
8.1.30.0050.00317.93
8.1.20.0030.00517.75
8.1.10.0000.00817.70
8.1.00.0080.00317.68
8.0.300.0040.00819.90
8.0.290.0000.00817.00
8.0.280.0040.00418.67
8.0.270.0030.00717.49
8.0.260.0030.00317.06
8.0.250.0000.00717.27
8.0.240.0090.00317.29
8.0.230.0000.00717.11
8.0.220.0040.00417.03
8.0.210.0040.00417.07
8.0.200.0100.00017.34
8.0.190.0000.00717.27
8.0.180.0030.00517.27
8.0.170.0000.00817.20
8.0.160.0040.00417.24
8.0.150.0050.00317.11
8.0.140.0040.00417.20
8.0.130.0030.00313.71
8.0.120.0040.00417.20
8.0.110.0000.00817.22
8.0.100.0040.00417.07
8.0.90.0050.00217.26
8.0.80.0120.00317.11
8.0.70.0000.00817.12
8.0.60.0080.00017.16
8.0.50.0040.00417.07
8.0.30.0040.01417.20
8.0.20.0130.00617.49
8.0.10.0000.00717.33
8.0.00.0080.01216.99
7.4.330.0020.00216.99
7.4.320.0000.00816.85
7.4.300.0030.00316.77
7.4.290.0000.00716.82
7.4.280.0000.00716.64
7.4.270.0030.00316.90
7.4.260.0030.00313.57
7.4.250.0000.00816.69
7.4.240.0000.00916.64
7.4.230.0000.00716.66
7.4.220.0150.00916.72
7.4.210.0100.00816.77
7.4.200.0000.00716.68
7.4.190.0040.00416.79
7.4.160.0040.01216.61
7.4.150.0140.01017.40
7.4.140.0090.01417.86
7.4.130.0110.00816.70
7.4.120.0090.01116.82
7.4.110.0090.01216.79
7.4.100.0110.00716.64
7.4.90.0150.01116.59
7.4.80.0050.01119.39
7.4.70.0100.00716.53
7.4.60.0170.00716.72
7.4.50.0040.00416.43
7.4.40.0130.00322.77
7.4.30.0090.00916.82
7.4.00.0100.00715.28
7.3.330.0000.00513.39
7.3.320.0000.00513.39
7.3.310.0040.00416.57
7.3.300.0070.00016.48
7.3.290.0060.00916.60
7.3.280.0090.00916.59
7.3.270.0140.00317.40
7.3.260.0130.00518.24
7.3.250.0090.00916.60
7.3.240.0130.00316.84
7.3.230.0100.01316.69
7.3.210.0080.00816.75
7.3.200.0090.00919.39
7.3.190.0110.00716.76
7.3.180.0120.00616.57
7.3.170.0190.00316.70
7.3.160.0060.01616.57
7.3.120.0100.00814.99
7.3.110.0080.00815.04
7.3.100.0050.00814.98
7.3.90.0050.00914.99
7.3.80.0060.00815.03
7.3.70.0080.00715.05
7.3.60.0040.01114.88
7.3.50.0070.00915.00
7.3.40.0110.00214.89
7.3.30.0070.00914.99
7.3.20.0060.00416.90
7.3.10.0080.00716.84
7.3.00.0070.00816.66
7.2.330.0080.01216.95
7.2.320.0140.00316.77
7.2.310.0160.00617.10
7.2.300.0090.01216.87
7.2.290.0060.01216.81
7.2.250.0060.01215.23
7.2.240.0090.00915.23
7.2.230.0030.01015.25
7.2.220.0060.00515.29
7.2.210.0060.01015.43
7.2.200.0090.00515.25
7.2.190.0050.00915.29
7.2.180.0030.01015.27
7.2.170.0050.01115.10
7.2.160.0060.00614.92
7.2.150.0060.00917.04
7.2.140.0070.01117.17
7.2.130.0090.00717.04
7.2.120.0120.00416.86
7.2.110.0060.00917.03
7.2.100.0120.00616.90
7.2.90.0080.00816.88
7.2.80.0130.00417.06
7.2.70.0120.00816.99
7.2.60.0120.00717.14
7.2.50.0080.00816.77
7.2.40.0070.00916.88
7.2.30.0080.01016.87
7.2.20.0120.00716.81
7.2.10.0110.00817.08
7.2.00.0070.00717.72
7.1.330.0050.01015.81
7.1.320.0090.00415.87
7.1.310.0090.00415.78
7.1.300.0060.00915.92
7.1.290.0000.01215.78
7.1.280.0060.00616.13
7.1.270.0050.00715.93
7.1.260.0030.01015.80
7.1.250.0130.00415.96
7.1.240.0090.01215.67
7.1.230.0080.01315.68
7.1.220.0140.00715.57
7.1.210.0110.01315.93
7.1.200.0190.00615.83
7.1.190.0120.00715.66
7.1.180.0210.00015.56
7.1.170.0090.00915.65
7.1.160.0150.00315.73
7.1.150.0140.00615.87
7.1.140.0110.00715.80
7.1.130.0080.01215.54
7.1.120.0100.00715.43
7.1.110.0120.00615.84
7.1.100.0030.01117.04
7.1.90.0130.00415.68
7.1.80.0060.01015.79
7.1.70.0050.00816.58
7.1.60.0100.00816.70
7.1.50.0100.00716.45
7.1.40.0080.00816.31
7.1.30.0130.00616.33
7.1.20.0110.01116.46
7.1.10.0060.00816.07
7.1.00.0100.00716.43
7.0.330.0070.01515.23
7.0.320.0180.00315.17
7.0.310.0160.00315.43
7.0.300.0150.00815.48
7.0.290.0120.00915.41
7.0.280.0160.00315.21
7.0.270.0190.00015.36
7.0.260.0110.00715.51
7.0.250.0070.00715.52
7.0.240.0060.01215.54
7.0.230.0090.00315.28
7.0.220.0090.00615.50
7.0.210.0060.00915.47
7.0.200.0120.00416.05
7.0.190.0100.00715.92
7.0.180.0070.00615.98
7.0.170.0060.00715.95
7.0.160.0110.00815.83
7.0.150.0120.00315.92
7.0.140.0130.00315.98
7.0.130.0100.00915.94
7.0.120.0060.00816.22
7.0.110.0120.00315.97
7.0.100.0070.00815.88
7.0.90.0120.00415.91
7.0.80.0090.00515.95
7.0.70.0080.00815.90
7.0.60.0060.00815.90
7.0.50.0110.00816.02
7.0.40.0030.01114.47
7.0.30.0050.01014.39
7.0.20.0060.01014.42
7.0.10.0090.00514.34
7.0.00.0040.01114.37
5.6.380.0040.01114.50
5.6.370.0100.00414.06
5.6.360.0090.00314.60
5.6.350.0050.01114.48
5.6.340.0080.00814.44
5.6.330.0040.00914.09
5.6.320.0060.00914.25
5.6.310.0040.01414.37
5.6.300.0070.02717.80
5.6.290.0090.03317.58
5.6.280.0040.03317.68
5.6.270.0110.03417.73
5.6.260.0030.03017.64
5.6.250.0050.03117.82
5.6.240.0050.02817.70
5.6.230.0090.02517.91
5.6.220.0070.03617.52
5.6.210.0070.02817.68
5.6.200.0080.02217.59
5.6.190.0070.02617.64
5.6.180.0030.04717.58
5.6.170.0070.03517.49
5.6.160.0050.02417.72
5.6.150.0090.02717.75
5.6.140.0070.02217.76
5.6.130.0100.02117.68
5.6.120.0090.02617.64
5.6.110.0080.03717.64
5.6.100.0090.03217.70
5.6.90.0070.03017.62
5.6.80.0090.02417.36
5.6.70.0100.02717.52
5.6.60.0070.04517.32
5.6.50.0100.02417.23
5.6.40.0070.02417.36
5.6.30.0080.02617.16
5.6.20.0090.02517.42
5.6.10.0100.02417.31
5.6.00.0030.02617.25
5.5.380.0080.01914.34
5.5.370.0100.04214.53
5.5.360.0040.02414.50
5.5.350.0080.02014.26
5.5.340.0050.02214.80
5.5.330.0050.04014.51
5.5.320.0070.02114.81
5.5.310.0030.02714.77
5.5.300.0000.02514.76
5.5.290.0070.02614.65
5.5.280.0030.02814.59
5.5.270.0050.02814.77
5.5.260.0060.02214.67
5.5.250.0020.03314.51
5.5.240.0070.02514.36
5.5.230.0120.02514.44
5.5.220.0070.02214.28
5.5.210.0020.02614.34
5.5.200.0070.02114.30
5.5.190.0090.01914.34
5.5.180.0090.02114.20
5.5.170.0040.00710.89
5.5.160.0040.02414.30
5.5.150.0030.02214.34
5.5.140.0020.02514.31
5.5.130.0020.02514.33
5.5.120.0020.02414.44
5.5.110.0100.01914.44
5.5.100.0030.02214.16
5.5.90.0040.02114.07
5.5.80.0060.02314.37
5.5.70.0100.01614.37
5.5.60.0000.02714.14
5.5.50.0070.02014.43
5.5.40.0070.02114.26
5.5.30.0080.03214.35
5.5.20.0020.02614.43
5.5.10.0030.02714.31
5.5.00.0050.02114.32
5.4.450.0020.02915.17
5.4.440.0020.02515.29
5.4.430.0030.02715.40
5.4.420.0070.02215.26
5.4.410.0090.02215.22
5.4.400.0030.02315.16
5.4.390.0070.02414.90
5.4.380.0080.02515.08
5.4.370.0040.02014.79
5.4.360.0030.02514.98
5.4.350.0030.02414.98
5.4.340.0070.02115.21
5.4.330.0000.01010.86
5.4.320.0050.02215.07
5.4.310.0080.01915.06
5.4.300.0040.03715.05
5.4.290.0050.02015.15
5.4.280.0050.03615.00
5.4.270.0050.02015.30
5.4.260.0040.02115.32
5.4.250.0060.02015.15
5.4.240.0060.02715.34
5.4.230.0000.02615.14
5.4.220.0070.03615.32
5.4.210.0020.02415.04
5.4.200.0010.03515.07
5.4.190.0000.02414.98
5.4.180.0030.02715.18
5.4.170.0060.02515.14
5.4.160.0060.02115.19
5.4.150.0020.02215.11
5.4.140.0070.02113.90
5.4.130.0020.02313.74
5.4.120.0020.02213.97
5.4.110.0050.02114.04
5.4.100.0050.02113.90
5.4.90.0030.02614.08
5.4.80.0000.02614.02
5.4.70.0080.02414.09
5.4.60.0070.03013.90
5.4.50.0080.02213.83
5.4.40.0040.02113.99
5.4.30.0070.01714.07
5.4.20.0080.04013.98
5.4.10.0090.02114.10
5.4.00.0020.03413.82
5.3.290.0030.02413.09
5.3.280.0070.02012.98
5.3.270.0040.02012.95
5.3.260.0020.02413.05
5.3.250.0050.02413.07
5.3.240.0020.02612.95
5.3.230.0000.03512.90
5.3.220.0030.02212.91
5.3.210.0020.02313.00
5.3.200.0070.01912.92
5.3.190.0020.02213.00
5.3.180.0050.03412.92
5.3.170.0030.02313.11
5.3.160.0010.02812.92
5.3.150.0050.01813.01
5.3.140.0030.02112.98
5.3.130.0070.02412.98
5.3.120.0050.04012.85
5.3.110.0000.02412.85
5.3.100.0040.02112.98
5.3.90.0030.02113.06
5.3.80.0040.01912.82
5.3.70.0000.02712.92
5.3.60.0030.02412.97
5.3.50.0030.03613.07
5.3.40.0040.02212.97
5.3.30.0040.02112.99
5.3.20.0050.02213.02
5.3.10.0060.02012.77
5.3.00.0070.02112.92
5.2.170.0060.01812.63
5.2.160.0040.01612.63
5.2.150.0050.02312.63
5.2.140.0050.03212.63
5.2.130.0020.02012.63
5.2.120.0040.02012.63
5.2.110.0030.01712.63
5.2.100.0030.01712.63
5.2.90.0000.02012.63
5.2.80.0050.01512.63
5.2.70.0040.01612.63
5.2.60.0030.02212.63
5.2.50.0030.02012.63
5.2.40.0020.01912.63
5.2.30.0050.01712.63
5.2.20.0030.02012.63
5.2.10.0050.01912.63
5.2.00.0050.02112.63
5.1.60.0000.02212.63
5.1.50.0040.01512.63
5.1.40.0040.02012.63
5.1.30.0030.01612.63
5.1.20.0030.01612.63
5.1.10.0030.01612.63
5.1.00.0020.01612.63
5.0.50.0060.00912.63
5.0.40.0050.01412.63
5.0.30.0050.01712.63
5.0.20.0060.00912.63
5.0.10.0000.01512.63
5.0.00.0000.02012.63
4.4.90.0090.01212.63
4.4.80.0010.01612.63
4.4.70.0020.01112.63
4.4.60.0030.01312.63
4.4.50.0030.01112.63
4.4.40.0020.01512.63
4.4.30.0000.01912.63
4.4.20.0030.00912.63
4.4.10.0030.01012.63
4.4.00.0050.01112.63
4.3.110.0030.01012.63
4.3.100.0030.00812.63
4.3.90.0030.00812.63
4.3.80.0000.01612.63
4.3.70.0010.01312.63
4.3.60.0020.01012.63
4.3.50.0030.00812.63
4.3.40.0060.01612.63
4.3.30.0060.01312.63
4.3.20.0000.01212.63
4.3.10.0030.00912.63
4.3.00.0030.01012.63

preferences:
51.64 ms | 401 KiB | 5 Q