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('../' . $tag); $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.70.0090.00618.93
8.3.60.0090.00619.06
8.3.50.0170.00322.13
8.3.40.0070.01419.29
8.3.30.0090.00619.52
8.3.20.0050.00320.80
8.3.10.0000.00822.47
8.3.00.0070.00322.95
8.2.180.0160.00319.16
8.2.170.0110.00422.96
8.2.160.0130.00621.38
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0000.00819.99
8.2.110.0060.00322.52
8.2.100.0070.00718.22
8.2.90.0030.00519.67
8.2.80.0000.00918.66
8.2.70.0000.00817.88
8.2.60.0000.00818.30
8.2.50.0050.00318.07
8.2.40.0080.00018.66
8.2.30.0040.00418.48
8.2.20.0050.00318.16
8.2.10.0040.00418.18
8.2.00.0000.00818.14
8.1.280.0120.00325.92
8.1.270.0000.00824.22
8.1.260.0030.00626.35
8.1.250.0060.00328.09
8.1.240.0090.00024.35
8.1.230.0040.00819.72
8.1.220.0040.00418.16
8.1.210.0040.00418.77
8.1.200.0040.00417.73
8.1.190.0050.00318.02
8.1.180.0040.00418.10
8.1.170.0030.00618.96
8.1.160.0060.00322.39
8.1.150.0040.00418.96
8.1.140.0000.00717.82
8.1.130.0070.00018.17
8.1.120.0040.00417.91
8.1.110.0000.00717.89
8.1.100.0080.00017.82
8.1.90.0040.00417.96
8.1.80.0040.00417.84
8.1.70.0070.00017.86
8.1.60.0040.00417.93
8.1.50.0050.00318.02
8.1.40.0080.00017.97
8.1.30.0030.00518.17
8.1.20.0000.00918.16
8.1.10.0040.00418.02
8.1.00.0040.00417.94
8.0.300.0000.00718.77
8.0.290.0040.00417.68
8.0.280.0050.00218.84
8.0.270.0070.00017.59
8.0.260.0000.00717.26
8.0.250.0070.00017.46
8.0.240.0040.00417.38
8.0.230.0070.00017.45
8.0.220.0030.00317.41
8.0.210.0000.00817.27
8.0.200.0000.00617.45
8.0.190.0000.00717.43
8.0.180.0000.00817.40
8.0.170.0060.00317.24
8.0.160.0070.00017.36
8.0.150.0000.00817.37
8.0.140.0040.00417.18
8.0.130.0000.00613.78
8.0.120.0000.00817.41
8.0.110.0040.00417.32
8.0.100.0040.00417.29
8.0.90.0000.00717.31
8.0.80.0100.00917.35
8.0.70.0080.00017.29
8.0.60.0040.00417.40
8.0.50.0000.00717.35
8.0.30.0110.00817.29
8.0.20.0080.01517.51
8.0.10.0040.00417.42
8.0.00.0140.00517.22
7.4.330.0060.00015.52
7.4.320.0030.00317.03
7.4.300.0070.00016.94
7.4.290.0000.00717.06
7.4.280.0030.00516.90
7.4.270.0050.00216.98
7.4.260.0040.00417.01
7.4.250.0040.00416.95
7.4.240.0000.00717.06
7.4.230.0030.00416.90
7.4.220.0120.01217.00
7.4.210.0070.00817.09
7.4.200.0050.00217.10
7.4.190.0000.00716.99
7.4.160.0080.01016.77
7.4.150.0100.01017.40
7.4.140.0160.00517.86
7.4.130.0110.00616.93
7.4.120.0050.01317.03
7.4.110.0090.01516.88
7.4.100.0060.01917.08
7.4.90.0130.01016.91
7.4.80.0110.00719.39
7.4.70.0100.00817.01
7.4.60.0100.00716.94
7.4.50.0000.00516.98
7.4.40.0030.00822.77
7.4.30.0140.00316.98
7.4.00.0060.00915.26
7.3.330.0000.00513.71
7.3.320.0060.00013.86
7.3.310.0000.00716.93
7.3.300.0040.00416.77
7.3.290.0060.01016.82
7.3.280.0100.00716.87
7.3.270.0110.00917.40
7.3.260.0120.00616.89
7.3.250.0110.00716.98
7.3.240.0060.01016.98
7.3.230.0040.01216.80
7.3.210.0060.01217.13
7.3.200.0120.00619.39
7.3.190.0060.01916.89
7.3.180.0030.01316.73
7.3.170.0100.00716.80
7.3.160.0170.00716.80
7.3.120.0030.01015.11
7.3.110.0120.00315.01
7.3.100.0070.01015.03
7.3.90.0040.01115.34
7.3.80.0100.00715.18
7.3.70.0070.00414.96
7.3.60.0100.00715.01
7.3.50.0060.00915.19
7.3.40.0030.01414.94
7.3.30.0070.00715.03
7.3.20.0070.00716.89
7.3.10.0070.01116.78
7.3.00.0150.00316.91
7.2.330.0090.00917.07
7.2.320.0030.01317.08
7.2.310.0030.01517.15
7.2.300.0080.00916.80
7.2.290.0110.00617.23
7.2.240.0000.01514.92
7.2.230.0030.01015.15
7.2.220.0030.01315.13
7.2.210.0060.00915.42
7.2.200.0140.00315.30
7.2.190.0070.00715.40
7.2.180.0060.00915.30
7.2.170.0070.01115.11
7.2.160.0070.01114.97
7.2.150.0070.01116.89
7.2.140.0030.01416.97
7.2.130.0130.00316.91
7.2.120.0060.01217.07
7.2.110.0030.01216.93
7.2.100.0070.00717.02
7.2.90.0030.00717.04
7.2.80.0100.00617.01
7.2.70.0090.00617.05
7.2.60.0060.01017.19
7.2.50.0080.00417.02
7.2.40.0070.01017.18
7.2.30.0030.01317.03
7.2.20.0110.00717.35
7.2.10.0030.01217.16
7.2.00.0020.01418.34
7.1.330.0030.01315.87
7.1.320.0040.01416.13
7.1.310.0120.00315.68
7.1.300.0080.00416.09
7.1.290.0060.00916.01
7.1.280.0100.00715.81
7.1.270.0100.00715.80
7.1.260.0100.00715.80
7.1.250.0130.00015.71
7.1.200.0150.00015.95
7.1.100.0060.00618.19
7.1.70.0040.01117.44
7.1.60.0040.02119.82
7.1.50.0070.01117.18
7.1.00.0130.08022.59
7.0.200.0130.00316.88
7.0.140.0070.07022.25
7.0.100.0130.04720.31
7.0.90.0330.07720.12
7.0.80.0170.06720.07
7.0.70.0000.04020.11
7.0.60.0100.04020.28
7.0.50.0000.04320.53
7.0.40.0070.04320.27
7.0.30.0030.04720.35
7.0.20.0100.06720.28
7.0.10.0130.07720.29
7.0.00.0070.07320.21
5.6.280.0030.07321.18
5.6.250.0000.04020.82
5.6.240.0100.04720.89
5.6.230.0030.06020.80
5.6.220.0070.05020.76
5.6.210.0100.04020.77
5.6.200.0070.04021.33
5.6.190.0070.08721.24
5.6.180.0100.07721.24
5.6.170.0100.07021.37
5.6.160.0170.06021.37
5.6.150.0070.08321.19
5.6.140.0100.03321.25
5.6.130.0100.05721.15
5.6.120.0170.03721.25
5.6.110.0170.07721.32
5.6.100.0000.06321.21
5.6.90.0100.03021.26
5.6.80.0030.07320.52
5.6.70.0070.03320.51
5.6.60.0030.06720.51
5.6.50.0130.06020.71
5.6.40.0030.05720.71
5.6.30.0070.03320.64
5.6.20.0030.04020.48
5.6.10.0130.06720.48
5.6.00.0100.08020.72
5.5.380.0030.04320.62
5.5.370.0070.07320.66
5.5.360.0070.08020.64
5.5.350.0070.04320.60
5.5.340.0030.03721.07
5.5.330.0030.09721.01
5.5.320.0130.08021.14
5.5.310.0070.04320.96
5.5.300.0000.04720.91
5.5.290.0000.04720.93
5.5.280.0070.03721.07
5.5.270.0030.05020.96
5.5.260.0070.08320.99
5.5.250.0000.04320.72
5.5.240.0100.07720.45
5.5.230.0030.07020.48
5.5.220.0130.05720.29
5.5.210.0130.07720.41
5.5.200.0030.07720.33
5.5.190.0070.05320.35
5.5.180.0130.07320.46
5.5.160.0070.07020.47
5.5.150.0100.07320.29
5.5.140.0070.04320.32
5.5.130.0070.08020.48
5.5.120.0130.05320.25
5.5.110.0030.03720.25
5.5.100.0100.07720.31
5.5.90.0000.05720.19
5.5.80.0070.03720.33
5.5.70.0030.04020.17
5.5.60.0030.08020.20
5.5.50.0070.07720.23
5.5.40.0070.05320.35
5.5.30.0130.07020.33
5.5.20.0070.06720.34
5.5.10.0130.07020.32
5.5.00.0030.04320.18
5.4.450.0030.04719.66
5.4.440.0070.06019.69
5.4.430.0170.06719.77
5.4.420.0130.07319.73
5.4.410.0100.06019.55
5.4.400.0070.04019.18
5.4.390.0000.04719.36
5.4.380.0030.03319.34
5.4.370.0070.06019.36
5.4.360.0000.07319.18
5.4.350.0100.03719.31
5.4.340.0100.06019.41
5.4.320.0030.04019.19
5.4.310.0170.06019.09
5.4.300.0000.08019.34
5.4.290.0030.03319.18
5.4.280.0100.07319.36
5.4.270.0170.06319.10
5.4.260.0070.07719.18
5.4.250.0070.05719.31
5.4.240.0030.07719.30
5.4.230.0030.04319.31
5.4.220.0000.07019.19
5.4.210.0100.06319.09
5.4.200.0230.05019.18
5.4.190.0100.02719.43
5.4.180.0170.06719.19
5.4.170.0070.03719.29
5.4.160.0030.06019.43
5.4.150.0030.05019.08
5.4.140.0070.04316.71
5.4.130.0000.06316.60
5.4.120.0000.06716.61
5.4.110.0070.05316.57
5.4.100.0070.05716.68
5.4.90.0100.07316.66
5.4.80.0000.07016.66
5.4.70.0000.03316.55
5.4.60.0070.07016.63
5.4.50.0100.02716.63
5.4.40.0100.07316.59
5.4.30.0070.05016.63
5.4.20.0000.05716.67
5.4.10.0000.05316.75
5.4.00.0030.07016.11
5.3.290.0030.07715.01
5.3.280.0170.04014.95
5.3.270.0070.06714.84
5.3.260.0030.06014.91
5.3.250.0000.04014.84
5.3.240.0170.02714.83
5.3.230.0070.04714.83
5.3.220.0070.03314.73
5.3.210.0130.06714.88
5.3.200.0030.03314.88
5.3.190.0030.07014.88
5.3.180.0030.08314.75
5.3.170.0000.04714.82
5.3.160.0100.07714.79
5.3.150.0070.06014.80
5.3.140.0000.05314.79
5.3.130.0070.03314.72
5.3.120.0130.05714.88
5.3.110.0100.06014.86
5.3.100.0070.09014.25
5.3.90.0130.06714.24
5.3.80.0070.07314.28
5.3.70.0100.06314.25
5.3.60.0030.03314.24
5.3.50.0070.04314.26
5.3.40.0030.03714.13
5.3.30.0000.06014.22
5.3.20.0000.04013.96
5.3.10.0030.07313.88
5.3.00.0100.03713.93
5.2.170.0070.02713.64
5.2.160.0070.03713.64
5.2.150.0070.07013.64
5.2.140.0000.05013.64
5.2.130.0030.02713.64
5.2.120.0070.06013.64
5.2.110.0070.06013.64
5.2.100.0000.06013.64
5.2.90.0030.04313.64
5.2.80.0130.02313.64
5.2.70.0070.06313.64
5.2.60.0030.06713.64
5.2.50.0070.05013.64
5.2.40.0030.06013.64
5.2.30.0030.05013.64
5.2.20.0030.03713.64
5.2.10.0070.04313.64
5.2.00.0030.06013.64
5.1.60.0100.02713.64
5.1.50.0030.05313.64
5.1.40.0070.05313.64
5.1.30.0070.05013.64
5.1.20.0070.02013.64
5.1.10.0000.02713.64
5.1.00.0070.04313.64
5.0.50.0000.04713.64
5.0.40.0030.04313.64
5.0.30.0030.03313.64
5.0.20.0070.04013.64
5.0.10.0000.04013.64
5.0.00.0030.06713.64
4.4.90.0000.03713.64
4.4.80.0000.02013.64
4.4.70.0000.03713.64
4.4.60.0000.04013.64
4.4.50.0030.03313.64
4.4.40.0100.04313.64
4.4.30.0000.02013.64
4.4.20.0030.03313.64
4.4.10.0000.03013.64
4.4.00.0030.03313.64
4.3.110.0030.01713.64
4.3.100.0030.03313.64
4.3.90.0000.03013.64
4.3.80.0000.02713.64
4.3.70.0030.01313.64
4.3.60.0000.01713.64
4.3.50.0000.04013.64
4.3.40.0000.03713.64
4.3.30.0030.03713.64
4.3.20.0000.01713.64
4.3.10.0000.03713.64
4.3.00.0000.03713.64

preferences:
64.99 ms | 401 KiB | 5 Q