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];

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.40.0090.00618.95
8.3.30.0180.00019.04
8.3.20.0050.00318.98
8.3.10.0060.00319.02
8.3.00.0080.00019.50
8.2.170.0090.00622.96
8.2.160.0100.00619.21
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00320.87
8.2.110.0100.00021.31
8.2.100.0060.00618.09
8.2.90.0030.00718.07
8.2.80.0060.00320.79
8.2.70.0030.00518.18
8.2.60.0000.00918.34
8.2.50.0040.00418.10
8.2.40.0080.00019.55
8.2.30.0040.00419.65
8.2.20.0060.00318.07
8.2.10.0040.00418.15
8.2.00.0040.00417.91
8.1.270.0090.00623.99
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00622.32
8.1.230.0080.00421.04
8.1.220.0050.00318.01
8.1.210.0090.00019.07
8.1.200.0030.00717.46
8.1.190.0040.00417.38
8.1.180.0040.00418.10
8.1.170.0040.00418.78
8.1.160.0040.00419.30
8.1.150.0040.00418.88
8.1.140.0000.00717.66
8.1.130.0000.00717.64
8.1.120.0030.00517.72
8.1.110.0030.00517.61
8.1.100.0000.00717.57
8.1.90.0040.00417.75
8.1.80.0030.00417.61
8.1.70.0070.00017.67
8.1.60.0080.00017.85
8.1.50.0030.00617.59
8.1.40.0030.00617.73
8.1.30.0030.00517.92
8.1.20.0040.00417.87
8.1.10.0000.00817.72
8.1.00.0050.00317.75
8.0.300.0060.00320.46
8.0.290.0050.00516.86
8.0.280.0060.00318.70
8.0.270.0000.00717.52
8.0.260.0040.00418.68
8.0.250.0030.00517.15
8.0.240.0070.00017.26
8.0.230.0040.00417.11
8.0.220.0050.00217.20
8.0.210.0000.00717.22
8.0.200.0030.00317.13
8.0.190.0050.00317.30
8.0.180.0080.00417.16
8.0.170.0030.00616.99
8.0.160.0040.00417.08
8.0.150.0070.00317.07
8.0.140.0030.00517.21
8.0.130.0000.00613.63
8.0.120.0040.00417.08
8.0.110.0000.00917.25
8.0.100.0050.00317.21
8.0.90.0040.00417.21
8.0.80.0100.01017.16
8.0.70.0000.00717.25
8.0.60.0030.00617.02
8.0.50.0060.00317.28
8.0.30.0150.00417.22
8.0.20.0140.00817.19
8.0.10.0000.00817.22
8.0.00.0110.00617.05
7.4.330.0000.00513.14
7.4.320.0060.00016.84
7.4.300.0000.00916.77
7.4.290.0030.00316.91
7.4.280.0040.00416.66
7.4.270.0040.00416.87
7.4.260.0000.00613.52
7.4.250.0040.00416.73
7.4.240.0040.00316.68
7.4.230.0030.00616.54
7.4.220.0090.00916.88
7.4.210.0060.01216.83
7.4.200.0050.00316.73
7.4.190.0080.00016.86
7.4.160.0100.00616.84
7.4.150.0030.02016.73
7.4.140.0190.00416.51
7.4.130.0070.01116.54
7.4.120.0110.00616.92
7.4.110.0130.00616.84
7.4.100.0120.00616.75
7.4.90.0100.01316.64
7.4.80.0140.00319.39
7.4.70.0080.00816.78
7.4.60.0060.01016.82
7.4.50.0040.00016.39
7.4.40.0100.00316.72
7.4.30.0100.00616.77
7.4.10.0060.01015.17
7.4.00.0070.01015.12
7.3.330.0000.00813.60
7.3.320.0040.00413.57
7.3.310.0070.00016.64
7.3.300.0040.00416.59
7.3.290.0090.00816.60
7.3.280.0060.01216.57
7.3.270.0100.00716.67
7.3.260.0030.01316.64
7.3.250.0110.01316.64
7.3.240.0100.01116.58
7.3.230.0100.00716.58
7.3.210.0100.00716.68
7.3.200.0160.00316.56
7.3.190.0090.01516.71
7.3.180.0030.01316.52
7.3.170.0030.01316.58
7.3.160.0060.01016.70
7.3.130.0060.01214.99
7.3.120.0080.00815.03
7.3.110.0100.01015.26
7.3.100.0000.01215.23
7.3.90.0000.01614.61
7.3.80.0060.00914.84
7.3.70.0080.00614.95
7.3.60.0040.01114.93
7.3.50.0070.00315.05
7.3.40.0000.01714.84
7.3.30.0070.01015.19
7.3.20.0070.01016.66
7.3.10.0030.01016.68
7.3.00.0050.01016.83
7.2.330.0060.01217.04
7.2.320.0130.00716.93
7.2.310.0110.00716.85
7.2.300.0030.01516.66
7.2.290.0090.00916.93
7.2.260.0040.01115.07
7.2.250.0060.01315.03
7.2.240.0120.00415.15
7.2.230.0110.00415.20
7.2.220.0070.00315.05
7.2.210.0070.00715.02
7.2.200.0080.00415.23
7.2.190.0070.00715.10
7.2.180.0080.00815.30
7.2.170.0080.00815.29
7.2.160.0030.01015.29
7.2.150.0030.01317.13
7.2.140.0000.01217.14
7.2.130.0050.00917.04
7.2.120.0060.00816.97
7.2.110.0090.00716.97
7.2.100.0080.00717.07
7.2.90.0100.00717.25
7.2.80.0060.00716.88
7.2.70.0070.00917.08
7.2.60.0060.00917.10
7.2.50.0010.00916.98
7.2.40.0100.00317.16
7.2.30.0060.00917.00
7.2.20.0050.00817.08
7.2.10.0020.01417.18
7.2.00.0090.00917.79
7.1.330.0070.00716.19
7.1.320.0090.00016.09
7.1.310.0070.00315.77
7.1.300.0040.00815.75
7.1.290.0060.00616.03
7.1.280.0070.01015.57
7.1.270.0060.00615.93
7.1.260.0060.00315.96
7.1.250.0070.00515.96
7.1.240.0060.00315.85
7.1.230.0100.00315.80
7.1.220.0000.01515.93
7.1.210.0040.01116.05
7.1.200.0050.00516.02
7.1.190.0060.00915.78
7.1.180.0070.00316.05
7.1.170.0040.00815.86
7.1.160.0080.00415.88
7.1.150.0030.00615.96
7.1.140.0000.01616.24
7.1.130.0030.00716.08
7.1.120.0070.00716.04
7.1.110.0070.00716.05
7.1.100.0000.00815.94
7.1.90.0070.00715.99
7.1.80.0070.00715.80
7.1.70.0050.00716.68
7.1.60.0080.01217.66
7.1.50.0070.01016.17
7.1.40.0090.00915.84
7.1.30.0000.01215.64
7.1.20.0030.00615.59
7.1.10.0000.01215.94
7.1.00.0020.02619.25
7.0.330.0040.00815.71
7.0.320.0080.00015.43
7.0.310.0070.00415.38
7.0.300.0000.01415.56
7.0.290.0000.00915.39
7.0.280.0040.00415.35
7.0.270.0030.01015.47
7.0.260.0040.00815.59
7.0.250.0110.00415.32
7.0.240.0090.00615.56
7.0.230.0030.00915.55
7.0.220.0060.00315.70
7.0.210.0070.00715.59
7.0.200.0040.00716.25
7.0.190.0030.01015.45
7.0.180.0040.00415.41
7.0.170.0070.00715.50
7.0.160.0060.00315.59
7.0.150.0040.00715.62
7.0.140.0000.04318.71
7.0.130.0000.01415.36
7.0.120.0030.03918.98
7.0.110.0000.00815.68
7.0.100.0060.00615.45
7.0.90.0000.00815.38
7.0.80.0060.00615.51
7.0.70.0030.01015.60
7.0.60.0070.04117.82
7.0.50.0030.02416.87
7.0.40.0070.02717.07
7.0.30.0270.03017.00
7.0.20.0080.02516.95
7.0.10.0060.03016.98
7.0.00.0070.04516.92
5.6.400.0040.01114.91
5.6.390.0080.00614.93
5.6.380.0080.00614.66
5.6.370.0060.00914.59
5.6.360.0090.00614.55
5.6.350.0070.00714.55
5.6.340.0040.01114.60
5.6.330.0090.00914.66
5.6.320.0060.00614.64
5.6.310.0080.00314.70
5.6.300.0050.00514.48
5.6.290.0030.01014.28
5.6.280.0050.04217.77
5.6.270.0030.01414.85
5.6.260.0060.00614.73
5.6.250.0100.00614.66
5.6.240.0080.00414.55
5.6.230.0000.01614.71
5.6.220.0040.00414.39
5.6.210.0070.04417.62
5.6.200.0070.04216.41
5.6.190.0040.02717.37
5.6.180.0120.02717.48
5.6.170.0170.04217.56
5.6.160.0070.04217.54
5.6.150.0100.03016.42
5.6.140.0030.03216.62
5.6.130.0030.03016.57
5.6.120.0030.04718.07
5.6.110.0070.03217.71
5.6.100.0080.03517.88
5.6.90.0100.03717.84
5.6.80.0080.04317.49
5.6.70.1400.01817.53
5.6.60.0100.00314.36
5.6.50.0070.00714.54
5.6.40.0130.00314.79
5.6.30.0000.01414.19
5.6.20.0100.00714.64
5.6.10.0060.00914.36
5.6.00.0070.00714.48
5.5.380.0090.00614.49
5.5.370.0040.00814.53
5.5.360.0060.00914.48
5.5.350.0100.04117.40
5.5.340.0050.04116.32
5.5.330.0040.03417.36
5.5.320.0220.02217.36
5.5.310.0220.03717.47
5.5.300.0040.02516.36
5.5.290.0110.03816.16
5.5.280.0080.02717.77
5.5.270.0040.02317.81
5.5.260.0110.04317.80
5.5.250.0070.04017.63
5.5.240.0100.02017.38
5.5.230.0060.00814.54
5.5.220.0040.00414.67
5.5.210.0060.00914.40
5.5.200.0060.01214.46
5.5.190.0120.00614.45
5.5.180.0070.01014.34
5.5.170.0030.01014.35
5.5.160.0080.00414.29
5.5.150.0110.00714.44
5.5.140.0000.00914.56
5.5.130.0060.00614.49
5.5.120.0060.00614.55
5.5.110.0060.00614.42
5.5.100.0060.00314.37
5.5.90.0070.01114.16
5.5.80.0120.00314.41
5.5.70.0000.01214.44
5.5.60.0090.00314.42
5.5.50.0030.01214.40
5.5.40.0040.00714.50
5.5.30.0030.01214.28
5.5.20.0000.00814.21
5.5.10.0040.01114.13
5.5.00.0000.01414.35
5.4.450.0060.02215.30
5.4.440.0040.02315.41
5.4.430.0060.02515.38
5.4.420.0030.02115.46
5.4.410.0080.01515.20
5.4.400.0030.02215.16
5.4.390.0050.02414.99
5.4.380.0090.01715.09
5.4.370.0020.02215.14
5.4.360.0100.01615.07
5.4.350.0080.02014.93
5.4.340.0000.02515.12
5.4.330.0060.00311.43
5.4.320.0100.01815.17
5.4.310.0030.02715.11
5.4.300.0050.03015.08
5.4.290.0020.03615.20
5.4.280.0030.02315.19
5.4.270.0050.01915.03
5.4.260.0050.04515.29
5.4.250.0070.04315.09
5.4.240.0080.03015.31
5.4.230.0070.02215.29
5.4.220.0050.04515.27
5.4.210.0050.03514.99
5.4.200.0030.02515.14
5.4.190.0080.03814.90
5.4.180.0080.03315.21
5.4.170.0080.03015.10
5.4.160.0030.03015.28
5.4.150.0020.02515.19
5.4.140.0070.03913.92
5.4.130.0020.04513.89
5.4.120.0090.03514.01
5.4.110.0030.04013.86
5.4.100.0040.04214.01
5.4.90.0060.03813.99
5.4.80.0060.01813.87
5.4.70.0030.03813.92
5.4.60.0030.02313.87
5.4.50.0060.02013.80
5.4.40.0050.02213.90
5.4.30.0060.03913.91
5.4.20.0020.03713.85
5.4.10.0020.03513.96
5.4.00.0090.03313.63
5.3.290.0100.02212.84
5.3.280.0050.04012.74
5.3.270.0060.04312.78
5.3.260.0070.02012.82
5.3.250.0020.02312.78
5.3.240.0050.03612.72
5.3.230.0040.02912.71
5.3.220.0030.02812.72
5.3.210.0080.03612.70
5.3.200.0050.03812.62
5.3.190.0050.02712.57
5.3.180.0000.02812.62
5.3.170.0040.04312.62
5.3.160.0060.02212.74
5.3.150.0030.02812.81
5.3.140.0050.02312.78
5.3.130.0050.04012.70
5.3.120.0070.03712.63
5.3.110.0030.02812.73
5.3.100.0050.03812.39
5.3.90.0010.02712.36
5.3.80.0020.02212.36
5.3.70.0080.01812.34
5.3.60.0050.01812.38
5.3.50.0020.02312.49
5.3.40.0030.04312.33
5.3.30.0030.02512.24
5.3.20.0040.02912.39
5.3.10.0030.02312.01
5.3.00.0050.03812.16
5.2.170.0000.03311.29
5.2.160.0030.03311.26
5.2.150.0030.05311.31
5.2.140.0030.04011.29
5.2.130.0000.03011.16
5.2.120.0000.03311.36
5.2.110.0000.04011.24
5.2.100.0170.04711.34
5.2.90.0070.05711.32
5.2.80.0170.05011.26
5.2.70.0030.06311.15
5.2.60.0070.06011.18
5.2.50.0070.05011.17
5.2.40.0000.06311.03
5.2.30.0030.06011.21
5.2.20.0100.05711.20
5.2.10.0070.04711.03
5.2.00.0070.05710.85
5.1.60.0030.05310.13
5.1.50.0030.04710.25
5.1.40.0030.03310.16
5.1.30.0070.04010.54
5.1.20.0030.03310.60
5.1.10.0030.05010.08
5.1.00.0070.02710.17
5.0.50.0000.0338.62
5.0.40.0000.0278.62
5.0.30.0030.0638.62
5.0.20.0070.0408.62
5.0.10.0000.0378.62
5.0.00.0030.0638.62
4.4.90.0030.0338.62
4.4.80.0000.0238.62
4.4.70.0030.0278.62
4.4.60.0000.0338.62
4.4.50.0000.0238.62
4.4.40.0070.0208.62
4.4.30.0000.0378.62
4.4.20.0000.0208.62
4.4.10.0000.0178.62
4.4.00.0000.0508.62
4.3.110.0000.0308.62
4.3.100.0000.0308.62
4.3.90.0030.0338.62
4.3.80.0000.0438.62
4.3.70.0000.0208.62
4.3.60.0000.0238.62
4.3.50.0000.0408.62
4.3.40.0100.0408.62
4.3.30.0030.0378.62
4.3.20.0030.0278.62
4.3.10.0000.0278.62
4.3.00.0030.0338.62

preferences:
48.83 ms | 400 KiB | 5 Q