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); } var_dump($this->xml->$offset->asXML()); 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']; $xml['note']['recursive'][0];

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.01118.93
8.3.50.0120.01122.11
8.3.40.0040.01118.84
8.3.30.0000.01419.09
8.3.20.0040.00419.02
8.3.10.0080.00021.22
8.3.00.0030.00623.73
8.2.180.0180.00016.75
8.2.170.0090.00622.96
8.2.160.0120.00319.12
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00021.50
8.2.110.0050.00520.63
8.2.100.0040.00818.28
8.2.90.0050.00319.50
8.2.80.0030.00518.28
8.2.70.0000.00817.75
8.2.60.0080.00018.18
8.2.50.0050.00318.07
8.2.40.0030.00618.47
8.2.30.0030.00621.36
8.2.20.0040.00418.05
8.2.10.0060.00318.00
8.2.00.0030.00518.09
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00022.59
8.1.230.0080.00421.15
8.1.220.0060.00318.77
8.1.210.0080.00019.28
8.1.200.0030.00617.60
8.1.190.0000.00717.78
8.1.180.0030.00618.10
8.1.170.0000.00918.88
8.1.160.0000.01119.03
8.1.150.0000.00818.86
8.1.140.0060.00317.61
8.1.130.0000.00718.11
8.1.120.0070.00017.72
8.1.110.0030.00617.64
8.1.100.0050.00217.70
8.1.90.0020.00517.80
8.1.80.0000.00817.63
8.1.70.0040.00417.68
8.1.60.0040.00417.86
8.1.50.0000.00717.75
8.1.40.0000.00817.69
8.1.30.0030.00617.82
8.1.20.0030.00517.96
8.1.10.0050.00317.77
8.1.00.0100.00017.83
8.0.300.0050.00320.20
8.0.290.0060.00317.30
8.0.280.0000.00818.75
8.0.270.0040.00417.48
8.0.260.0070.00317.06
8.0.250.0080.00017.24
8.0.240.0000.00817.29
8.0.230.0000.00717.26
8.0.220.0070.00017.16
8.0.210.0000.00717.12
8.0.200.0030.00317.25
8.0.190.0050.00317.21
8.0.180.0070.00017.19
8.0.170.0000.00717.16
8.0.160.0050.00217.14
8.0.150.0000.00717.02
8.0.140.0040.00417.16
8.0.130.0030.00313.66
8.0.120.0000.00717.05
8.0.110.0040.00417.05
8.0.100.0050.00217.05
8.0.90.0080.00017.06
8.0.80.0060.01017.08
8.0.70.0040.00416.91
8.0.60.0000.00916.98
8.0.50.0040.00417.19
8.0.30.0070.01417.38
8.0.20.0100.00917.47
8.0.10.0030.00317.31
8.0.00.0120.00616.74
7.4.330.0050.00014.93
7.4.320.0040.00416.79
7.4.300.0060.00016.81
7.4.290.0070.00016.79
7.4.280.0080.00016.90
7.4.270.0030.00316.75
7.4.260.0050.00013.66
7.4.250.0000.00816.88
7.4.240.0030.00316.84
7.4.230.0040.00416.97
7.4.220.0030.01416.82
7.4.210.0080.00716.75
7.4.200.0040.00416.91
7.4.190.0020.00517.02
7.4.160.0100.01416.92
7.4.150.0150.00417.40
7.4.140.0070.01017.86
7.4.130.0040.01316.66
7.4.120.0120.00716.69
7.4.110.0120.00616.90
7.4.100.0060.01216.84
7.4.90.0070.01316.63
7.4.80.0110.01119.39
7.4.70.0160.00616.87
7.4.60.0000.01916.76
7.4.50.0000.00816.68
7.4.40.0080.00822.77
7.4.30.0100.01016.90
7.4.00.0090.01015.20
7.3.330.0030.00313.58
7.3.320.0020.00213.64
7.3.310.0000.00716.55
7.3.300.0040.00416.54
7.3.290.0040.01116.64
7.3.280.0080.00916.65
7.3.270.0340.02217.40
7.3.260.0140.00518.24
7.3.250.0110.00616.64
7.3.240.0060.01316.88
7.3.230.0070.01016.71
7.3.210.0100.00716.77
7.3.200.0040.01519.39
7.3.190.0160.00316.88
7.3.180.0030.01416.88
7.3.170.0120.00916.80
7.3.160.0130.00316.75
7.3.120.0090.00214.98
7.3.110.0030.01414.70
7.3.100.0150.00314.98
7.3.90.0040.00714.80
7.3.80.0080.00314.82
7.3.70.0060.00614.88
7.3.60.0040.00815.14
7.3.50.0030.01015.05
7.3.40.0130.00314.97
7.3.30.0040.01115.14
7.3.20.0030.00916.59
7.3.10.0050.00516.76
7.3.00.0060.00716.56
7.2.330.0090.00916.82
7.2.320.0060.01216.66
7.2.310.0070.01716.86
7.2.300.0130.00917.11
7.2.290.0100.00716.91
7.2.250.0030.01615.18
7.2.240.0130.00315.20
7.2.230.0090.00914.91
7.2.220.0000.01015.43
7.2.210.0040.01115.10
7.2.200.0070.00415.05
7.2.190.0060.00615.22
7.2.180.0070.00715.24
7.2.170.0040.00815.36
7.2.130.0130.00616.73
7.2.120.0070.01116.94
7.2.110.0030.01617.01
7.2.100.0100.01016.92
7.2.90.0040.01117.05
7.2.80.0070.01116.88
7.2.70.0030.00716.92
7.2.60.0070.00316.86
7.2.50.0070.01016.99
7.2.40.0060.00816.63
7.2.30.0090.00016.79
7.2.20.0070.01016.72
7.2.10.0100.00717.07
7.2.00.0070.00718.52
7.1.330.0000.01615.74
7.1.320.0030.00616.03
7.1.310.0070.00715.81
7.1.300.0090.00315.88
7.1.290.0030.00615.98
7.1.280.0070.00715.96
7.1.270.0040.01115.66
7.1.260.0040.00715.97
7.1.250.0050.00515.84
7.1.100.0080.00418.18
7.1.70.0080.01117.42
7.1.60.0120.00919.40
7.1.50.0130.01317.12
7.1.00.0100.05322.42
7.0.200.0030.00716.70
7.0.140.0100.06322.13
7.0.100.0300.08020.08
7.0.90.0100.07020.21
7.0.80.0170.07020.20
7.0.70.0170.07319.97
7.0.60.0370.08320.07
7.0.50.0030.06720.41
7.0.40.0070.08020.23
7.0.30.0230.03720.28
7.0.20.0170.07720.21
7.0.10.0030.09020.10
7.0.00.0130.07720.27
5.6.280.0030.07320.98
5.6.250.0030.05020.90
5.6.240.0030.06720.75
5.6.230.0170.03320.58
5.6.220.0070.08720.76
5.6.210.0070.06720.87
5.6.200.0070.08021.15
5.6.190.0130.07321.17
5.6.180.0170.07021.29
5.6.170.0070.07721.11
5.6.160.0100.07721.13
5.6.150.0070.07021.14
5.6.140.0030.08021.24
5.6.130.0030.05021.02
5.6.120.0200.03721.14
5.6.110.0100.07321.19
5.6.100.0170.07021.16
5.6.90.0100.03720.98
5.6.80.0100.08320.64
5.6.70.0170.07020.52
5.6.60.0130.07020.57
5.6.50.0100.07320.52
5.6.40.0030.06320.50
5.6.30.0070.08720.59
5.6.20.0100.07320.52
5.6.10.0070.04020.52
5.6.00.0030.04720.52
5.5.380.0070.08320.42
5.5.370.0130.03720.58
5.5.360.0200.04320.43
5.5.350.0130.08020.43
5.5.340.0070.04720.89
5.5.330.0170.06320.82
5.5.320.0070.08721.02
5.5.310.0070.08721.02
5.5.300.0130.07720.88
5.5.290.0070.07720.99
5.5.280.0100.08021.07
5.5.270.0100.06020.89
5.5.260.0130.07021.02
5.5.250.0030.04320.86
5.5.240.0130.06020.39
5.5.230.0030.08320.41
5.5.220.0070.05720.27
5.5.210.0100.07720.37
5.5.200.0030.08320.22
5.5.190.0070.06020.25
5.5.180.0000.07720.18
5.5.160.0030.08320.25
5.5.150.0070.08320.39
5.5.140.0100.06320.14
5.5.130.0030.07720.14
5.5.120.0200.06320.39
5.5.110.0070.07720.31
5.5.100.0070.08320.26
5.5.90.0200.06320.27
5.5.80.0130.07320.04
5.5.70.0070.03720.22
5.5.60.0030.04020.24
5.5.50.0000.04320.02
5.5.40.0070.03720.02
5.5.30.0030.04020.09
5.5.20.0070.03720.27
5.5.10.0100.03320.11
5.5.00.0100.03320.15
5.4.450.0100.07319.45
5.4.440.0070.04319.56
5.4.430.0130.08019.56
5.4.420.0070.08019.55
5.4.410.0070.06019.15
5.4.400.0000.04719.33
5.4.390.0030.08319.26
5.4.380.0030.08019.23
5.4.370.0070.06019.30
5.4.360.0070.04019.28
5.4.350.0100.04319.37
5.4.340.0100.05719.29
5.4.320.0000.06719.27
5.4.310.0100.06718.95
5.4.300.0100.05319.11
5.4.290.0100.04018.92
5.4.280.0070.04319.23
5.4.270.0100.06319.10
5.4.260.0070.08719.10
5.4.250.0100.04719.23
5.4.240.0100.04018.95
5.4.230.0100.04019.24
5.4.220.0070.03719.10
5.4.210.0030.04019.27
5.4.200.0030.04319.18
5.4.190.0070.03718.91
5.4.180.0000.04019.23
5.4.170.0030.04019.09
5.4.160.0000.04019.24
5.4.150.0070.04018.95
5.4.140.0030.03716.62
5.4.130.0030.04716.59
5.4.120.0070.04716.54
5.4.110.0070.03016.60
5.4.100.0000.04016.57
5.4.90.0030.03316.69
5.4.80.0070.03016.52
5.4.70.0100.03016.51
5.4.60.0030.03716.67
5.4.50.0030.03016.61
5.4.40.0030.03716.47
5.4.30.0000.03316.55
5.4.20.0070.03316.57
5.4.10.0000.04316.57
5.4.00.0070.03315.95
5.3.290.0170.03314.82
5.3.280.0100.03014.79
5.3.270.0030.04014.80
5.3.260.0000.04014.74
5.3.250.0070.03314.75
5.3.240.0000.04014.74
5.3.230.0000.04314.75
5.3.220.0070.03014.73
5.3.210.0000.06014.71
5.3.200.0030.04014.63
5.3.190.0030.04714.75
5.3.180.0100.02714.84
5.3.170.0030.03714.70
5.3.160.0030.04014.82
5.3.150.0070.03014.72
5.3.140.0000.04014.73
5.3.130.0030.04314.71
5.3.120.0130.02714.70
5.3.110.0070.04714.63
5.3.100.0070.03714.10
5.3.90.0030.04014.25
5.3.80.0000.03314.25
5.3.70.0030.03714.27
5.3.60.0000.03714.13
5.3.50.0030.03714.18
5.3.40.0100.02314.13
5.3.30.0000.03713.92
5.3.20.0000.03713.88
5.3.10.0030.03313.79
5.3.00.0070.02713.78
5.2.170.0000.03011.30
5.2.160.0030.02711.29
5.2.150.0070.02011.29
5.2.140.0030.03011.14
5.2.130.0030.03011.26
5.2.120.0000.03011.33
5.2.110.0070.02311.24
5.2.100.0000.03011.24
5.2.90.0100.02011.29
5.2.80.0070.02711.08
5.2.70.0000.03011.33
5.2.60.0000.02711.20
5.2.50.0030.03311.20
5.2.40.0000.02711.16
5.2.30.0030.02711.12
5.2.20.0000.03311.20
5.2.10.0000.02711.04
5.2.00.0030.02310.90
5.1.60.0000.02010.20
5.1.50.0030.02310.10
5.1.40.0000.04310.09
5.1.30.0070.05310.60
5.1.20.0000.06010.50
5.1.10.0030.0309.97
5.1.00.0030.05710.12
5.0.50.0070.0378.66
5.0.40.0070.0238.50
5.0.30.0030.0308.35
5.0.20.0030.0278.27
5.0.10.0000.0478.26
5.0.00.0070.0638.19
4.4.90.0000.0137.96
4.4.80.0000.0207.96
4.4.70.0000.0137.96
4.4.60.0000.0137.96
4.4.50.0030.0137.96
4.4.40.0070.0177.96
4.4.30.0000.0177.96
4.4.20.0030.0277.96
4.4.10.0000.0207.96
4.4.00.0070.0507.96
4.3.110.0000.0337.96
4.3.100.0030.0337.96
4.3.90.0000.0207.96
4.3.80.0030.0307.96
4.3.70.0000.0377.96
4.3.60.0030.0307.96
4.3.50.0000.0377.96
4.3.40.0000.0377.96
4.3.30.0000.0307.96
4.3.20.0000.0377.96
4.3.10.0030.0307.96
4.3.00.0000.0337.96

preferences:
67.65 ms | 401 KiB | 5 Q