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)) { var_dump($this->xml); 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']; echo $xml['note']['recursive']['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.0110.01117.25
8.3.50.0150.00018.36
8.3.40.0160.00319.20
8.3.30.0070.00719.48
8.3.20.0040.00420.46
8.3.10.0000.00723.86
8.3.00.0040.00420.88
8.2.180.0040.01116.88
8.2.170.0000.01522.96
8.2.160.0060.00820.68
8.2.150.0000.00824.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0030.00621.01
8.2.110.0030.00719.52
8.2.100.0080.00318.16
8.2.90.0080.00019.42
8.2.80.0000.00818.00
8.2.70.0060.00317.75
8.2.60.0050.00318.18
8.2.50.0060.00318.07
8.2.40.0030.00621.41
8.2.30.0050.00218.42
8.2.20.0080.00018.14
8.2.10.0000.00818.41
8.2.00.0040.00418.00
8.1.270.0080.00024.10
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00024.13
8.1.230.0070.00417.86
8.1.220.0040.00417.89
8.1.210.0030.00618.77
8.1.200.0020.00717.63
8.1.190.0040.00417.60
8.1.180.0030.00618.10
8.1.170.0060.00318.88
8.1.160.0050.00222.15
8.1.150.0030.00618.88
8.1.140.0040.00417.68
8.1.130.0040.00418.12
8.1.120.0040.00417.77
8.1.110.0000.00817.67
8.1.100.0070.00017.62
8.1.90.0040.00417.80
8.1.80.0040.00417.76
8.1.70.0030.00317.64
8.1.60.0080.00017.84
8.1.50.0060.00317.85
8.1.40.0000.00817.82
8.1.30.0030.00617.94
8.1.20.0040.00417.85
8.1.10.0000.00817.92
8.1.00.0030.00617.76
8.0.300.0040.00418.77
8.0.290.0000.00717.54
8.0.280.0030.00318.73
8.0.270.0070.00017.66
8.0.260.0030.00317.45
8.0.250.0040.00317.20
8.0.240.0000.00717.11
8.0.230.0080.00017.20
8.0.220.0070.00017.18
8.0.210.0050.00317.19
8.0.200.0030.00317.29
8.0.190.0000.00917.19
8.0.180.0000.00717.20
8.0.170.0030.00617.15
8.0.160.0040.00417.17
8.0.150.0020.00517.07
8.0.140.0000.00817.02
8.0.130.0070.00013.57
8.0.120.0080.00017.05
8.0.110.0040.00417.09
8.0.100.0040.00417.05
8.0.90.0080.00017.21
8.0.80.0040.01117.04
8.0.70.0040.00417.21
8.0.60.0040.00417.15
8.0.50.0000.00817.20
8.0.30.0170.00717.37
8.0.20.0110.00917.40
8.0.10.0000.00717.17
8.0.00.0090.00917.20
7.4.330.0050.00015.00
7.4.320.0040.00416.80
7.4.300.0000.00616.75
7.4.290.0030.00316.68
7.4.280.0040.00416.88
7.4.270.0000.00716.77
7.4.260.0040.00416.77
7.4.250.0000.00716.80
7.4.240.0060.00216.81
7.4.230.0000.00716.61
7.4.220.0180.00616.92
7.4.210.0050.00916.88
7.4.200.0000.00716.98
7.4.190.0040.00417.06
7.4.160.0000.01617.02
7.4.150.0080.01217.40
7.4.140.0100.00917.86
7.4.130.0080.00916.77
7.4.120.0050.01216.87
7.4.110.0100.00716.89
7.4.100.0060.01116.79
7.4.90.0090.01616.93
7.4.80.0150.00719.39
7.4.70.0110.00416.66
7.4.60.0080.01216.72
7.4.50.0050.00016.75
7.4.40.0100.01016.67
7.4.30.0130.00716.71
7.4.00.0030.01015.26
7.3.330.0060.00013.44
7.3.320.0000.00813.44
7.3.310.0030.00516.64
7.3.300.0030.00316.59
7.3.290.0080.00516.66
7.3.280.0110.00616.64
7.3.270.0040.01517.40
7.3.260.0140.00417.05
7.3.250.0110.00816.62
7.3.240.0070.01116.71
7.3.230.0130.00316.68
7.3.210.0130.01016.91
7.3.200.0060.01219.39
7.3.190.0130.00316.70
7.3.180.0060.01516.59
7.3.170.0110.00416.94
7.3.160.0160.00016.64
7.3.120.0070.01015.16
7.2.330.0100.01016.99
7.2.320.0130.00317.02
7.2.310.0110.00716.82
7.2.300.0090.00916.77
7.2.290.0140.00417.05
7.2.00.0060.00919.67
7.1.100.0060.00618.35
7.1.70.0040.00417.17
7.1.60.0130.01019.46
7.1.50.0000.02217.12
7.1.00.0070.07322.59
7.0.200.0040.00416.72
7.0.140.0030.07322.19
7.0.100.0070.05320.21
7.0.90.0070.04320.07
7.0.80.0100.04320.09
7.0.70.0000.04320.10
7.0.60.0030.05720.09
7.0.50.0070.07020.52
7.0.40.0070.07720.05
7.0.30.0100.04320.16
7.0.20.0030.05320.25
7.0.10.0030.04320.22
7.0.00.0070.04720.28
5.6.280.0000.07721.08
5.6.250.0070.06720.75
5.6.240.0030.04320.91
5.6.230.0070.04020.72
5.6.220.0100.03720.80
5.6.210.0030.03320.80
5.6.200.0030.05721.16
5.6.190.0070.08021.30
5.6.180.0130.07721.25
5.6.170.0000.04021.14
5.6.160.0070.04721.30
5.6.150.0000.07021.11
5.6.140.0070.04721.23
5.6.130.0030.04321.08
5.6.120.0100.03721.11
5.6.110.0100.03721.14
5.6.100.0000.04721.08
5.6.90.0030.04721.13
5.6.80.0100.08320.41
5.6.70.0030.04320.64
5.6.60.0030.04020.52
5.6.50.0000.04320.34
5.6.40.0070.03720.39
5.6.30.0070.03320.39
5.6.20.0070.04320.36
5.6.10.0030.05320.45
5.6.00.0070.08020.38
5.5.380.0100.04020.45
5.5.370.0000.04320.63
5.5.360.0100.03320.68
5.5.350.0000.04320.41
5.5.340.0070.06321.07
5.5.330.0030.07020.95
5.5.320.0070.03720.91
5.5.310.0030.04021.05
5.5.300.0030.04320.80
5.5.290.0070.04320.98
5.5.280.0000.04720.93
5.5.270.0030.04320.89
5.5.260.0200.02720.79
5.5.250.0000.05020.68
5.5.240.0030.04020.21
5.5.230.0100.03020.25
5.5.220.0070.03720.25
5.5.210.0000.07020.33
5.5.200.0030.03720.38
5.5.190.0000.04720.18
5.5.180.0100.06020.18
5.5.160.0070.08020.28
5.5.150.0170.06720.25
5.5.140.0030.07720.15
5.5.130.0130.07320.26
5.5.120.0070.07020.30
5.5.110.0000.06720.34
5.5.100.0170.07020.14
5.5.90.0070.07320.23
5.5.80.0070.06020.26
5.5.70.0100.04320.22
5.5.60.0100.04020.25
5.5.50.0070.07720.12
5.5.40.0030.08020.12
5.5.30.0030.08020.09
5.5.20.0070.07720.11
5.5.10.0070.07720.23
5.5.00.0130.04020.25
5.4.450.0030.05719.57
5.4.440.0000.04319.62
5.4.430.0000.04319.35
5.4.420.0070.03719.35
5.4.410.0030.04019.48
5.4.400.0000.04019.00
5.4.390.0070.07719.27
5.4.380.0100.03319.34
5.4.370.0000.04319.39
5.4.360.0000.04019.30
5.4.350.0100.03019.13
5.4.340.0000.04019.02
5.4.320.0030.08319.29
5.4.310.0030.07318.96
5.4.300.0130.07319.13
5.4.290.0070.08319.03
5.4.280.0100.04019.28
5.4.270.0070.07019.26
5.4.260.0030.04019.11
5.4.250.0000.06719.08
5.4.240.0130.06019.27
5.4.230.0070.05319.02
5.4.220.0030.08319.33
5.4.210.0100.08019.26
5.4.200.0070.07319.11
5.4.190.0070.07719.24
5.4.180.0070.04719.23
5.4.170.0130.06319.20
5.4.160.0030.08019.25
5.4.150.0170.06019.10
5.4.140.0070.07316.60
5.4.130.0070.04016.66
5.4.120.0070.06716.54
5.4.110.0030.07716.61
5.4.100.0070.07316.54
5.4.90.0100.04716.64
5.4.80.0030.07316.59
5.4.70.0070.07316.56
5.4.60.0100.04316.51
5.4.50.0070.07316.60
5.4.40.0130.06716.50
5.4.30.0000.04716.62
5.4.20.0030.07016.57
5.4.10.0100.07316.47
5.4.00.0070.06015.99
5.3.290.0170.04714.90
5.3.280.0070.08014.76
5.3.270.0200.06714.77
5.3.260.0030.07014.88
5.3.250.0030.04714.77
5.3.240.0030.04714.80
5.3.230.0170.06714.76
5.3.220.0100.06014.73
5.3.210.0070.08014.62
5.3.200.0100.05014.73
5.3.190.0070.04314.75
5.3.180.0070.08314.63
5.3.170.0100.04314.80
5.3.160.0100.06714.80
5.3.150.0130.03714.61
5.3.140.0130.04014.72
5.3.130.0030.07714.75
5.3.120.0030.05014.82
5.3.110.0100.06714.82
5.3.100.0100.05014.28
5.3.90.0100.07314.31
5.3.80.0030.07014.27
5.3.70.0070.06014.16
5.3.60.0130.06014.20
5.3.50.0100.06714.19
5.3.40.0030.07314.12
5.3.30.0130.03714.15
5.3.20.0070.07313.85
5.3.10.0070.07013.81
5.3.00.0030.07713.79
5.2.170.0030.06711.34
5.2.160.0070.05711.34
5.2.150.0100.05311.34
5.2.140.0070.06011.41
5.2.130.0070.05311.26
5.2.120.0070.04711.30
5.2.110.0130.05711.26
5.2.100.0030.06711.09
5.2.90.0070.04711.30
5.2.80.0030.06711.26
5.2.70.0030.04711.25
5.2.60.0000.06711.21
5.2.50.0000.07311.30
5.2.40.0000.06011.27
5.2.30.0070.05311.07
5.2.20.0030.05311.20
5.2.10.0070.03011.03
5.2.00.0030.06010.73
5.1.60.0100.02310.28
5.1.50.0100.03710.10
5.1.40.0070.05310.11
5.1.30.0030.05710.60
5.1.20.0070.04010.62
5.1.10.0100.05010.20
5.1.00.0070.05010.12
5.0.50.0000.0478.47
5.0.40.0000.0478.52
5.0.30.0030.0678.47
5.0.20.0070.0378.47
5.0.10.0130.0338.47
5.0.00.0100.0508.47
4.4.90.0070.0308.47
4.4.80.0030.0338.47
4.4.70.0030.0408.47
4.4.60.0030.0378.47
4.4.50.0000.0408.47
4.4.40.0000.0438.47
4.4.30.0070.0338.47
4.4.20.0030.0378.47
4.4.10.0030.0378.47
4.4.00.0100.0438.47
4.3.110.0070.0338.47
4.3.100.0000.0378.47
4.3.90.0070.0178.47
4.3.80.0030.0538.47
4.3.70.0030.0338.47
4.3.60.0030.0338.47
4.3.50.0030.0338.47
4.3.40.0000.0508.47
4.3.30.0070.0238.47
4.3.20.0000.0408.47
4.3.10.0000.0378.47
4.3.00.0000.0278.47

preferences:
60.36 ms | 400 KiB | 5 Q