3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; public function __construct($filePath, $isUrl = true) { $this->isUrl = $isUrl; $this->xml = new SimpleXmlIterator($filePath, 0, $isUrl); } public function offsetExists($offset) { return !is_null($this->xml->$offset); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } if (is_int($offset)) { return new self($this->xml[$offset]->asXML(), false); } return new self($this->xml->$offset->asXML(), false); } public function __toString() { return (string) $this->xml; } 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; } } $str = '<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don\'t forget me this weekend!</body> <recursive> <val>2</val> <val>4</val> </recursive> </note>'; $xml = new XmlArrayAccessIterator($str, false); //echo $xml['note']['to']; var_dump($xml['note']['recursive'][1]['val']);

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.0070.01418.93
8.3.50.0120.00921.27
8.3.40.0090.00619.14
8.3.30.0100.00320.63
8.3.20.0040.00420.46
8.3.10.0040.00422.34
8.3.00.0060.00322.64
8.2.180.0090.00917.00
8.2.170.0120.00322.96
8.2.160.0070.00722.68
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0100.01026.16
8.2.120.0040.00421.38
8.2.110.0030.00619.59
8.2.100.0080.00418.47
8.2.90.0040.00419.47
8.2.80.0040.00419.64
8.2.70.0000.00817.86
8.2.60.0080.00418.18
8.2.50.0040.00418.07
8.2.40.0050.00318.47
8.2.30.0040.00419.73
8.2.20.0000.00817.98
8.2.10.0030.00618.02
8.2.00.0000.00818.07
8.1.280.0090.00625.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00024.16
8.1.230.0040.00819.47
8.1.220.0000.00818.14
8.1.210.0000.00918.77
8.1.200.0030.00617.73
8.1.190.0000.00817.88
8.1.180.0040.00418.10
8.1.170.0030.00518.92
8.1.160.0040.00419.16
8.1.150.0000.00818.93
8.1.140.0000.00917.74
8.1.130.0000.00718.13
8.1.120.0000.00717.60
8.1.110.0040.00417.69
8.1.100.0050.00217.64
8.1.90.0040.00417.72
8.1.80.0070.00017.80
8.1.70.0050.00317.68
8.1.60.0090.00017.76
8.1.50.0080.00017.75
8.1.40.0040.00417.79
8.1.30.0000.00817.78
8.1.20.0030.00617.82
8.1.10.0040.00417.80
8.1.00.0030.00517.71
8.0.300.0000.00718.77
8.0.290.0070.00017.53
8.0.280.0040.00418.63
8.0.270.0070.00017.55
8.0.260.0030.00317.14
8.0.250.0080.00017.19
8.0.240.0000.00817.34
8.0.230.0070.00017.32
8.0.220.0000.00717.19
8.0.210.0040.00417.24
8.0.200.0000.00617.28
8.0.190.0040.00417.32
8.0.180.0000.00917.31
8.0.170.0050.00317.24
8.0.160.0000.00717.34
8.0.150.0050.00317.15
8.0.140.0040.00417.26
8.0.130.0060.00013.63
8.0.120.0060.00317.24
8.0.110.0050.00317.24
8.0.100.0040.00417.29
8.0.90.0050.00217.14
8.0.80.0000.01617.13
8.0.70.0040.00417.34
8.0.60.0050.00217.26
8.0.50.0040.00417.13
8.0.30.0130.01017.49
8.0.20.0070.01217.47
8.0.10.0050.00317.25
8.0.00.0210.02117.09
7.4.330.0060.00015.00
7.4.320.0070.00016.71
7.4.300.0000.00616.93
7.4.290.0060.00616.70
7.4.280.0000.00716.71
7.4.270.0000.00716.90
7.4.260.0040.00413.56
7.4.250.0050.00316.80
7.4.240.0020.00516.85
7.4.230.0000.00716.93
7.4.220.0130.01316.91
7.4.210.0070.00816.89
7.4.200.0040.00416.69
7.4.190.0050.00216.90
7.4.160.0110.00616.86
7.4.150.0110.00717.40
7.4.140.0130.00617.86
7.4.130.0120.00916.82
7.4.120.0140.00516.71
7.4.110.0080.01016.67
7.4.100.0100.00717.01
7.4.90.0040.01316.80
7.4.80.0090.00819.39
7.4.70.0110.00716.86
7.4.60.0060.01216.76
7.4.50.0090.00016.88
7.4.40.0030.01222.77
7.4.30.0040.01416.71
7.4.00.0080.00915.25
7.3.330.0000.00613.72
7.3.320.0060.00013.65
7.3.310.0080.00016.73
7.3.300.0050.00216.61
7.3.290.0090.00616.64
7.3.280.0090.00916.67
7.3.270.0110.00517.40
7.3.260.0070.01016.90
7.3.250.0110.00916.92
7.3.240.0070.01116.93
7.3.230.0100.00716.63
7.3.210.0040.01216.71
7.3.200.0120.00619.39
7.3.190.0120.00616.84
7.3.180.0150.00916.75
7.3.170.0040.01216.68
7.3.160.0150.00616.82
7.3.120.0080.00815.12
7.3.110.0070.01014.98
7.3.100.0080.00814.82
7.3.90.0060.01014.94
7.3.80.0090.00315.06
7.3.70.0080.00714.93
7.3.60.0070.00514.98
7.3.50.0090.00914.96
7.3.40.0060.00415.14
7.3.30.0070.00515.16
7.3.20.0090.00517.01
7.3.10.0020.01216.62
7.3.00.0050.00716.65
7.2.330.0080.01116.82
7.2.320.0180.00016.76
7.2.310.0100.01317.11
7.2.300.0030.01517.01
7.2.290.0060.01116.98
7.2.250.0110.00815.21
7.2.240.0030.01415.29
7.2.230.0100.00815.19
7.2.220.0060.00815.13
7.2.210.0030.01215.36
7.2.200.0080.00815.35
7.2.190.0030.01015.34
7.2.180.0080.01115.21
7.2.170.0030.00615.23
7.2.160.0130.00315.10
7.2.150.0030.00717.18
7.2.140.0040.00917.03
7.2.130.0050.00817.09
7.2.120.0100.00517.12
7.2.110.0040.01017.10
7.2.100.0030.00616.97
7.2.90.0050.01017.08
7.2.80.0070.00817.00
7.2.70.0050.01217.14
7.2.60.0050.00817.13
7.2.50.0070.00917.24
7.2.40.0060.01117.19
7.2.30.0120.00116.98
7.2.20.0040.01117.06
7.2.10.0030.01017.17
7.2.00.0030.01117.93
7.1.330.0040.01215.92
7.1.320.0100.00315.87
7.1.310.0040.01216.00
7.1.300.0060.00815.84
7.1.290.0040.00915.92
7.1.280.0030.00815.89
7.1.270.0070.00516.00
7.1.260.0060.00615.91
7.1.250.0050.00715.81
7.1.240.0050.01015.88
7.1.230.0110.00115.91
7.1.220.0040.00615.92
7.1.210.0050.00815.96
7.1.200.0050.00715.92
7.1.190.0060.00815.90
7.1.180.0060.00715.94
7.1.170.0090.00615.90
7.1.160.0070.00715.97
7.1.150.0040.01115.93
7.1.140.0080.00415.91
7.1.130.0030.01215.97
7.1.120.0050.00815.92
7.1.110.0050.00716.02
7.1.100.0020.00916.69
7.1.90.0070.00916.01
7.1.80.0080.00615.80
7.1.70.0070.00516.52
7.1.60.0040.00816.44
7.1.50.0080.00816.25
7.1.40.0070.00415.72
7.1.30.0030.01315.81
7.1.20.0060.00715.98
7.1.10.0050.00816.02
7.1.00.0050.01818.07
7.0.330.0030.00815.59
7.0.320.0030.00515.43
7.0.310.0080.00515.39
7.0.300.0050.00915.46
7.0.290.0050.00815.63
7.0.280.0100.00515.52
7.0.270.0020.00715.47
7.0.260.0030.01015.53
7.0.250.0020.01215.57
7.0.240.0040.00815.66
7.0.230.0040.01015.52
7.0.220.0090.00515.51
7.0.210.0090.00315.64
7.0.200.0050.01015.95
7.0.190.0070.00715.52
7.0.180.0100.00315.53
7.0.170.0060.00815.58
7.0.160.0020.01215.41
7.0.150.0020.01315.44
7.0.140.0030.03017.71
7.0.130.0020.01215.55
7.0.120.0050.00715.62
7.0.110.0040.00715.53
7.0.100.0080.03017.11
7.0.90.0130.02217.02
7.0.80.0050.03317.13
7.0.70.0040.03317.01
7.0.60.0070.03217.10
7.0.50.0060.02817.13
7.0.40.0070.03515.88
7.0.30.0060.03315.92
7.0.20.0090.03015.93
7.0.10.0090.02916.04
7.0.00.0050.02915.93
5.6.400.0070.01014.57
5.6.390.0040.00714.57
5.6.380.0060.00914.62
5.6.370.0060.00914.47
5.6.360.0070.00414.82
5.6.350.0050.00714.49
5.6.340.0050.00614.73
5.6.330.0080.00614.66
5.6.320.0040.00914.69
5.6.310.0100.00414.75
5.6.300.0030.00814.77
5.6.290.0050.00914.79
5.6.280.0070.00614.62
5.6.270.0060.00914.42
5.6.260.0070.00514.63
5.6.250.0090.02716.62
5.6.240.0070.03116.57
5.6.230.0080.02016.64
5.6.220.0090.03216.51
5.6.210.0050.03416.63
5.6.200.0040.03416.61
5.6.190.0050.03316.76
5.6.180.0100.02416.80
5.6.170.0110.01816.76
5.6.160.0050.02416.74
5.6.150.0060.02216.63
5.6.140.0030.03516.88
5.6.130.0050.03116.66
5.6.120.0080.02816.76
5.6.110.0050.03516.86
5.6.100.0070.02416.71
5.6.90.0030.03816.62
5.6.80.0080.02916.56
5.6.70.0100.03016.43
5.6.60.0090.01716.51
5.6.50.0080.03016.41
5.6.40.0040.03316.61
5.6.30.0090.02916.58
5.6.20.0080.01816.54
5.6.10.0010.03116.68
5.6.00.0050.03416.39
5.5.380.0020.03415.46
5.5.370.0090.03015.57
5.5.360.0050.03415.40
5.5.350.0050.03115.55
5.5.340.0090.02815.46
5.5.330.0070.01915.70
5.5.320.0060.03115.65
5.5.310.0050.03015.65
5.5.300.0060.02815.53
5.5.290.0070.03015.71
5.5.280.0070.03115.64
5.5.270.0030.03215.58
5.5.260.0040.02815.64
5.5.250.0040.03215.43
5.5.240.0040.02515.38
5.5.230.0070.03015.42
5.5.220.0030.03315.34
5.5.210.0050.03215.39
5.5.200.0070.03115.37
5.5.190.0030.03315.36
5.5.180.0050.02915.32
5.5.170.0010.00712.71
5.5.160.0030.03215.29
5.5.150.0050.01815.34
5.5.140.0080.02215.31
5.5.130.0030.03015.23
5.5.120.0050.03215.21
5.5.110.0050.02615.28
5.5.100.0040.02815.32
5.5.90.0070.02615.30
5.5.80.0060.02615.31
5.5.70.0050.02515.24
5.5.60.0050.02315.25
5.5.50.0070.02715.18
5.5.40.0060.02915.33
5.5.30.0020.03115.24
5.5.20.0090.02615.13
5.5.10.0080.03115.29
5.5.00.0050.03115.21
5.4.450.0060.03214.95
5.4.440.0080.02815.00
5.4.430.0070.03014.91
5.4.420.0020.03414.99
5.4.410.0070.02914.92
5.4.400.0100.02514.80
5.4.390.0030.03014.88
5.4.380.0020.03314.85
5.4.370.0020.02214.85
5.4.360.0070.02814.89
5.4.350.0050.03214.77
5.4.340.0050.03014.79
5.4.330.0040.00812.64
5.4.320.0060.03014.90
5.4.310.0050.03114.97
5.4.300.0060.02714.85
5.4.290.0060.02714.76
5.4.280.0050.02814.85
5.4.270.0060.02914.77
5.4.260.0040.03114.86
5.4.250.0090.02414.89
5.4.240.0100.02414.80
5.4.230.0080.02814.79
5.4.220.0090.02514.74
5.4.210.0060.02914.85
5.4.200.0070.02114.74
5.4.190.0070.02914.85
5.4.180.0050.03214.83
5.4.170.0080.02514.88
5.4.160.0080.02814.85
5.4.150.0060.02814.83
5.4.140.0050.02913.92
5.4.130.0050.03113.95
5.4.120.0050.02813.94
5.4.110.0040.02114.02
5.4.100.0050.03113.97
5.4.90.0050.02513.95
5.4.80.0060.02913.95
5.4.70.0100.02413.96
5.4.60.0020.02513.94
5.4.50.0050.02913.95
5.4.40.0050.02713.97
5.4.30.0050.02514.00
5.4.20.0090.02514.02
5.4.10.0070.02513.98
5.4.00.0080.02013.78
5.3.290.0020.02713.35
5.3.280.0040.03113.37
5.3.270.0020.03113.32
5.3.260.0050.02913.39
5.3.250.0030.03013.34
5.3.240.0040.03013.39
5.3.230.0040.02913.34
5.3.220.0040.01913.37
5.3.210.0060.01913.33
5.3.200.0030.03013.33
5.3.190.0030.03113.36
5.3.180.0080.02613.30
5.3.170.0050.02913.34
5.3.160.0070.02613.33
5.3.150.0040.02813.32
5.3.140.0020.03013.34
5.3.130.0030.02913.33
5.3.120.0030.02713.33
5.3.110.0030.03113.37
5.3.100.0040.03113.20
5.3.90.0070.02413.12
5.3.80.0030.03213.15
5.3.70.0070.02913.15
5.3.60.0010.03013.14
5.3.50.0010.02913.14
5.3.40.0040.02913.15
5.3.30.0040.02813.09
5.3.20.0020.02813.02
5.3.10.0070.02613.01
5.3.00.0000.03213.03
5.2.170.0050.03411.28
5.2.160.0030.02811.18
5.2.150.0070.03411.24
5.2.140.0010.03511.23
5.2.130.0060.03111.22
5.2.120.0070.02811.24
5.2.110.0030.03311.23
5.2.100.0030.03611.15
5.2.90.0030.03011.22
5.2.80.0020.02911.27
5.2.70.0070.03211.18
5.2.60.0070.03211.19
5.2.50.0100.02711.24
5.2.40.0070.02711.13
5.2.30.0050.03011.20
5.2.20.0040.02711.14
5.2.10.0030.03311.10
5.2.00.0030.03411.06
5.1.60.0050.02910.62
5.1.50.0000.03510.65
5.1.40.0050.03010.66
5.1.30.0030.03010.77
5.1.20.0030.03210.79
5.1.10.0050.02910.63
5.1.00.0050.03110.56
5.0.50.0030.0259.88
5.0.40.0020.0269.84
5.0.30.0020.0399.64
5.0.20.0050.0229.75
5.0.10.0070.0209.72
5.0.00.0030.0219.73
4.4.90.0020.0219.50
4.4.80.0030.0189.50
4.4.70.0020.0229.50
4.4.60.0000.0189.50
4.4.50.0020.0209.50
4.4.40.0040.0259.50
4.4.30.0000.0219.50
4.4.20.0010.0199.50
4.4.10.0000.0159.50
4.4.00.0020.0239.50
4.3.110.0000.0179.50
4.3.100.0020.0209.50
4.3.90.0060.0139.50
4.3.80.0030.0289.50
4.3.70.0030.0189.50
4.3.60.0050.0179.50
4.3.50.0010.0209.50
4.3.40.0020.0239.50
4.3.30.0020.0219.50
4.3.20.0050.0179.50
4.3.10.0020.0229.50
4.3.00.0020.0189.50

preferences:
49.53 ms | 400 KiB | 5 Q