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)) { $tag = $this->xml->getName(); $target = $this->xml->xpath('..'); var_dump($target);die; $target = $target[$offset]; return new self($target->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'][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.60.0150.00719.05
8.3.50.0130.01022.24
8.3.40.0030.01319.18
8.3.30.0120.00919.18
8.3.20.0040.00419.23
8.3.10.0080.00021.42
8.3.00.0030.00624.04
8.2.180.0120.00917.00
8.2.170.0070.00722.96
8.2.160.0100.00320.78
8.2.150.0030.00624.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0060.00321.40
8.2.110.0080.00322.55
8.2.100.0070.00418.34
8.2.90.0030.00519.73
8.2.80.0040.00418.40
8.2.70.0080.00418.00
8.2.60.0000.00818.17
8.2.50.0060.00318.18
8.2.40.0070.00418.34
8.2.30.0030.00620.36
8.2.20.0060.00318.24
8.2.10.0030.00518.16
8.2.00.0030.00618.17
8.1.270.0000.00823.99
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0100.00321.23
8.1.230.0110.00021.35
8.1.220.0000.00818.77
8.1.210.0060.00319.34
8.1.200.0000.01017.85
8.1.190.0000.00818.03
8.1.180.0080.00018.10
8.1.170.0000.00819.16
8.1.160.0030.00519.26
8.1.150.0040.00419.12
8.1.140.0000.00817.77
8.1.130.0030.00318.18
8.1.120.0000.00817.74
8.1.110.0000.00717.94
8.1.100.0050.00317.95
8.1.90.0020.00517.79
8.1.80.0030.00517.92
8.1.70.0070.00017.84
8.1.60.0000.00817.87
8.1.50.0040.00417.74
8.1.40.0000.00818.04
8.1.30.0000.00918.09
8.1.20.0000.00818.03
8.1.10.0030.00517.99
8.1.00.0000.01317.83
8.0.300.0090.00020.42
8.0.290.0040.00417.25
8.0.280.0000.00718.77
8.0.270.0040.00417.71
8.0.260.0030.00317.23
8.0.250.0000.00817.28
8.0.240.0000.00917.27
8.0.230.0070.00017.27
8.0.220.0030.00317.31
8.0.210.0040.00417.23
8.0.200.0060.00017.45
8.0.190.0050.00317.37
8.0.180.0030.00717.35
8.0.170.0040.00417.33
8.0.160.0000.00817.38
8.0.150.0090.00017.34
8.0.140.0040.00417.19
8.0.130.0030.00313.92
8.0.120.0040.00417.33
8.0.110.0040.00417.24
8.0.100.0040.00417.23
8.0.90.0040.00417.41
8.0.80.0070.01117.34
8.0.70.0040.00417.28
8.0.60.0030.00617.28
8.0.50.0040.00417.27
8.0.30.0110.01017.58
8.0.20.0080.01017.50
8.0.10.0020.00517.35
8.0.00.0030.01517.21
7.4.330.0050.00015.14
7.4.320.0030.00316.99
7.4.300.0040.00417.05
7.4.290.0050.00217.02
7.4.280.0000.00716.96
7.4.270.0000.00716.89
7.4.260.0060.00013.64
7.4.250.0040.00416.89
7.4.240.0040.00416.88
7.4.230.0030.00416.72
7.4.220.0070.01017.06
7.4.210.0090.00616.98
7.4.200.0030.00316.99
7.4.190.0000.00717.20
7.4.160.0100.01416.89
7.4.150.0100.00717.40
7.4.140.0080.01217.86
7.4.130.0100.00817.00
7.4.120.0120.00517.15
7.4.110.0040.01516.96
7.4.100.0070.01017.08
7.4.90.0030.01416.93
7.4.80.0030.01419.37
7.4.70.0160.00316.95
7.4.60.0000.01817.03
7.4.50.0060.00317.09
7.4.40.0080.00722.27
7.4.30.0110.00616.90
7.4.00.0030.01315.26
7.3.330.0000.00513.79
7.3.320.0000.00613.87
7.3.310.0030.00516.62
7.3.300.0000.00716.80
7.3.290.0100.00716.83
7.3.280.0120.00616.87
7.3.270.0070.01017.40
7.3.260.0120.00618.24
7.3.250.0100.01116.98
7.3.240.0130.00316.87
7.3.230.0040.01316.81
7.3.210.0060.01217.09
7.3.200.0110.00819.39
7.3.190.0100.00716.96
7.3.180.0070.01016.75
7.3.170.0070.01017.11
7.3.160.0040.01216.91
7.3.120.0040.01115.17
7.3.110.0150.00015.14
7.3.100.0000.01015.29
7.3.90.0060.00914.95
7.3.80.0070.00714.99
7.3.70.0070.01015.06
7.3.60.0000.01815.11
7.3.50.0060.00915.01
7.3.40.0040.00815.32
7.3.30.0040.01114.99
7.3.20.0060.00816.78
7.3.10.0060.00616.83
7.3.00.0100.00616.85
7.2.330.0150.00316.90
7.2.320.0060.01317.15
7.2.310.0130.01017.10
7.2.300.0030.01317.23
7.2.290.0160.00616.97
7.2.240.0040.01115.32
7.2.230.0030.01015.16
7.2.220.0030.01415.33
7.2.210.0030.00615.33
7.2.200.0030.01015.18
7.2.190.0060.00615.18
7.2.180.0090.00615.18
7.2.170.0100.00315.14
7.2.160.0090.00615.18
7.2.150.0090.00616.98
7.2.140.0090.00616.87
7.2.130.0030.01417.07
7.2.120.0120.00617.14
7.2.110.0060.00917.06
7.2.100.0000.01217.20
7.2.90.0100.00717.14
7.2.80.0100.00717.15
7.2.70.0090.00617.02
7.2.60.0070.00817.07
7.2.50.0070.00716.98
7.2.40.0100.00717.07
7.2.30.0000.01617.32
7.2.20.0130.00317.25
7.2.10.0090.00917.18
7.2.00.0060.00918.33
7.1.330.0000.01416.11
7.1.320.0000.00915.89
7.1.310.0000.01515.98
7.1.300.0090.00916.02
7.1.290.0060.00315.93
7.1.280.0040.00815.83
7.1.270.0080.00315.96
7.1.260.0030.00815.89
7.1.250.0060.00616.18
7.1.200.0100.00615.87
7.1.100.0060.00618.23
7.1.70.0000.01017.19
7.1.60.0170.00719.40
7.1.50.0110.01517.16
7.1.00.0030.07722.64
7.0.200.0090.00617.12
7.0.140.0070.07022.24
7.0.100.0330.05020.29
7.0.90.0000.04720.13
7.0.80.0130.03020.23
7.0.70.0030.04020.27
7.0.60.0030.04320.22
7.0.50.0130.04320.50
7.0.40.0130.04720.18
7.0.30.0030.04320.31
7.0.20.0070.04320.27
7.0.10.0030.03320.20
7.0.00.0070.07020.29
5.6.280.0070.07021.24
5.6.250.0030.04720.81
5.6.240.0030.04320.86
5.6.230.0070.04020.86
5.6.220.0130.03320.76
5.6.210.0070.03720.69
5.6.200.0000.05321.11
5.6.190.0030.05721.18
5.6.180.0100.04021.23
5.6.170.0030.04321.21
5.6.160.0100.04321.13
5.6.150.0070.03721.32
5.6.140.0070.03721.12
5.6.130.0030.04321.08
5.6.120.0170.02321.29
5.6.110.0030.04021.25
5.6.100.0030.04321.12
5.6.90.0070.04021.11
5.6.80.0070.03720.66
5.6.70.0100.03020.63
5.6.60.0030.04320.64
5.6.50.0100.03320.55
5.6.40.0030.04020.50
5.6.30.0100.03320.54
5.6.20.0000.04320.63
5.6.10.0130.06320.54
5.6.00.0070.03720.57
5.5.380.0070.04320.50
5.5.370.0030.03720.63
5.5.360.0070.04320.60
5.5.350.0030.04320.58
5.5.340.0130.05321.07
5.5.330.0100.03721.02
5.5.320.0030.04720.97
5.5.310.0100.03721.05
5.5.300.0030.03720.93
5.5.290.0070.04021.01
5.5.280.0000.04321.05
5.5.270.0030.03720.88
5.5.260.0000.06020.80
5.5.250.0000.04020.88
5.5.240.0030.04320.29
5.5.230.0030.03720.34
5.5.220.0030.04020.38
5.5.210.0070.04020.23
5.5.200.0030.03720.28
5.5.190.0030.07020.32
5.5.180.0130.07020.40
5.5.160.0130.07020.38
5.5.150.0170.06020.41
5.5.140.0200.05720.26
5.5.130.0070.07720.27
5.5.120.0230.03020.21
5.5.110.0030.08020.27
5.5.100.0130.07720.33
5.5.90.0130.07320.31
5.5.80.0170.07020.16
5.5.70.0100.06320.30
5.5.60.0100.04320.12
5.5.50.0170.07720.25
5.5.40.0070.07720.15
5.5.30.0070.07320.11
5.5.20.0170.06320.20
5.5.10.0100.07320.28
5.5.00.0030.08020.11
5.4.450.0030.03719.65
5.4.440.0030.05019.53
5.4.430.0030.03319.72
5.4.420.0130.03319.77
5.4.410.0070.03319.52
5.4.400.0070.03719.20
5.4.390.0030.04019.04
5.4.380.0030.03719.30
5.4.370.0030.03719.31
5.4.360.0000.04319.31
5.4.350.0070.04019.35
5.4.340.0070.05319.33
5.4.320.0130.07019.32
5.4.310.0030.05719.11
5.4.300.0070.06319.06
5.4.290.0030.04319.09
5.4.280.0030.05019.44
5.4.270.0230.07019.40
5.4.260.0100.07719.44
5.4.250.0170.06019.32
5.4.240.0030.08019.30
5.4.230.0070.03719.32
5.4.220.0130.07319.32
5.4.210.0030.04719.44
5.4.200.0130.06719.08
5.4.190.0030.08719.17
5.4.180.0100.04719.44
5.4.170.0100.07319.34
5.4.160.0100.08019.08
5.4.150.0030.08319.31
5.4.140.0070.07716.64
5.4.130.0030.04316.48
5.4.120.0070.07016.58
5.4.110.0130.06716.65
5.4.100.0130.05716.67
5.4.90.0130.06316.61
5.4.80.0130.04016.64
5.4.70.0070.07316.64
5.4.60.0030.07716.59
5.4.50.0070.03316.82
5.4.40.0100.07016.66
5.4.30.0070.07316.55
5.4.20.0170.05316.65
5.4.10.0070.06716.66
5.4.00.0130.04716.01
5.3.290.0070.08014.99
5.3.280.0100.07314.80
5.3.270.0070.06314.88
5.3.260.0100.07714.77
5.3.250.0000.07714.91
5.3.240.0100.07014.84
5.3.230.0000.08014.78
5.3.220.0070.08314.73
5.3.210.0130.08314.80
5.3.200.0200.06314.88
5.3.190.0000.08314.75
5.3.180.0070.07714.91
5.3.170.0100.05714.88
5.3.160.0170.06314.88
5.3.150.0100.07314.89
5.3.140.0100.07014.87
5.3.130.0100.03314.73
5.3.120.0130.07014.84
5.3.110.0130.07314.81
5.3.100.0030.08014.25
5.3.90.0030.06014.25
5.3.80.0070.03714.24
5.3.70.0030.07314.32
5.3.60.0070.04014.37
5.3.50.0000.07314.19
5.3.40.0000.05714.26
5.3.30.0100.05714.18
5.3.20.0100.03713.93
5.3.10.0100.04013.79
5.3.00.0070.07313.89
5.2.170.0070.05711.30
5.2.160.0000.06311.48
5.2.150.0000.04311.41
5.2.140.0070.06311.49
5.2.130.0130.05011.38
5.2.120.0070.04711.31
5.2.110.0030.05711.41
5.2.100.0070.04311.31
5.2.90.0070.05711.40
5.2.80.0030.06711.33
5.2.70.0100.05711.39
5.2.60.0070.05311.39
5.2.50.0070.04711.14
5.2.40.0000.06711.26
5.2.30.0070.05711.20
5.2.20.0070.06311.27
5.2.10.0030.06311.16
5.2.00.0000.06310.95
5.1.60.0070.04710.22
5.1.50.0000.03010.17
5.1.40.0000.03310.15
5.1.30.0000.05310.55
5.1.20.0070.03010.37
5.1.10.0100.04710.17
5.1.00.0030.0579.98
5.0.50.0070.0208.68
5.0.40.0100.0278.52
5.0.30.0000.0608.33
5.0.20.0070.0338.34
5.0.10.0000.0508.20
5.0.00.0000.0608.18
4.4.90.0000.0377.45
4.4.80.0000.0377.45
4.4.70.0030.0237.45
4.4.60.0000.0307.45
4.4.50.0000.0377.45
4.4.40.0030.0377.45
4.4.30.0000.0307.45
4.4.20.0070.0337.45
4.4.10.0070.0277.45
4.4.00.0030.0537.45
4.3.110.0030.0377.45
4.3.100.0030.0377.45
4.3.90.0070.0307.45
4.3.80.0030.0377.45
4.3.70.0070.0107.45
4.3.60.0000.0337.45
4.3.50.0030.0277.45
4.3.40.0000.0537.45
4.3.30.0030.0377.45
4.3.20.0000.0337.45
4.3.10.0000.0177.45
4.3.00.0030.0237.45

preferences:
52.63 ms | 400 KiB | 5 Q