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 (preg_match('/(\w+)(\[\d+\])/', $offset, $nodes)) { var_dump($nodes); return new self($this->xml->$nodes[1]->$nodes[2]->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']; $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.0040.01517.25
8.3.60.0090.00618.93
8.3.50.0130.00422.19
8.3.40.0060.00919.34
8.3.30.0110.00719.31
8.3.20.0000.00820.57
8.3.10.0060.00323.92
8.3.00.0070.01121.06
8.2.180.0040.01517.00
8.2.170.0040.01422.96
8.2.160.0120.00920.60
8.2.150.0060.00924.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00021.07
8.2.110.0030.00622.50
8.2.100.0050.00520.79
8.2.90.0050.00519.57
8.2.80.0060.00318.13
8.2.70.0040.00718.00
8.2.60.0070.00319.73
8.2.50.0000.01018.13
8.2.40.0030.00618.43
8.2.30.0000.00818.69
8.2.20.0050.00318.23
8.2.10.0030.00618.39
8.2.00.0080.00018.14
8.1.280.0070.00725.92
8.1.270.0060.00323.92
8.1.260.0100.01026.35
8.1.250.0040.01428.09
8.1.240.0100.00022.36
8.1.230.0120.00019.59
8.1.220.0000.00818.13
8.1.210.0040.00418.77
8.1.200.0030.00717.85
8.1.190.0050.00317.85
8.1.180.0080.00018.10
8.1.170.0000.00818.95
8.1.160.0000.00822.31
8.1.150.0070.00019.01
8.1.140.0040.00417.93
8.1.130.0000.00718.12
8.1.120.0040.00417.90
8.1.110.0040.00417.91
8.1.100.0040.00417.85
8.1.90.0070.00017.87
8.1.80.0040.00417.85
8.1.70.0000.00817.76
8.1.60.0000.00817.89
8.1.50.0000.00817.86
8.1.40.0040.00417.93
8.1.30.0030.00618.10
8.1.20.0080.00018.05
8.1.10.0000.00818.02
8.1.00.0060.00317.93
8.0.300.0090.00018.77
8.0.290.0040.00417.25
8.0.280.0040.00418.74
8.0.270.0040.00317.54
8.0.260.0000.00817.56
8.0.250.0030.00317.41
8.0.240.0000.00717.50
8.0.230.0040.00417.43
8.0.220.0030.00317.34
8.0.210.0030.00617.41
8.0.200.0040.00417.42
8.0.190.0030.00517.34
8.0.180.0080.00017.33
8.0.170.0070.00017.30
8.0.160.0000.00717.41
8.0.150.0000.00717.36
8.0.140.0080.00017.22
8.0.130.0000.00613.78
8.0.120.0080.00017.25
8.0.110.0000.00717.21
8.0.100.0000.00817.28
8.0.90.0040.00417.39
8.0.80.0060.01017.43
8.0.70.0000.00717.43
8.0.60.0040.00417.23
8.0.50.0000.00717.37
8.0.30.0100.01317.58
8.0.20.0100.00917.49
8.0.10.0070.00017.60
8.0.00.0050.01317.38
7.4.330.0030.00315.29
7.4.320.0000.00717.00
7.4.300.0000.00717.02
7.4.290.0020.00517.13
7.4.280.0070.00016.88
7.4.270.0000.00817.11
7.4.260.0000.00717.11
7.4.250.0050.00216.93
7.4.240.0040.00417.06
7.4.230.0070.00017.18
7.4.220.0030.01417.10
7.4.210.0120.00917.12
7.4.200.0000.00717.11
7.4.160.0070.01016.80
7.4.150.0140.01117.40
7.4.140.0130.00517.86
7.4.130.0080.01017.06
7.4.120.0110.00717.06
7.4.110.0060.01217.11
7.4.100.0120.00917.11
7.4.90.0140.00517.10
7.4.80.0120.00619.39
7.4.70.0070.01017.02
7.4.60.0120.00916.83
7.4.50.0060.00616.85
7.4.40.0090.00916.98
7.4.30.0130.00316.86
7.4.00.0040.00815.29
7.3.330.0050.00013.71
7.3.320.0040.00413.61
7.3.310.0040.00416.82
7.3.300.0030.00316.68
7.3.290.0140.00716.86
7.3.280.0090.00816.85
7.3.270.0060.01217.40
7.3.260.0100.00917.09
7.3.250.0090.01216.93
7.3.240.0080.00817.03
7.3.230.0100.01017.08
7.3.210.0060.01216.90
7.3.200.0080.00819.39
7.3.190.0090.00917.01
7.3.180.0060.01216.97
7.3.170.0070.01616.86
7.3.160.0070.01016.98
7.3.120.0000.01515.43
7.3.10.0170.00616.61
7.3.00.0180.00316.62
7.2.330.0040.01416.88
7.2.320.0000.01817.16
7.2.310.0140.00817.09
7.2.300.0060.01017.01
7.2.290.0000.01917.09
7.2.130.0100.00717.29
7.2.120.0120.01416.79
7.2.110.0100.00817.13
7.2.100.0130.00717.00
7.2.90.0110.00417.08
7.2.80.0030.01317.01
7.2.70.0040.01216.81
7.2.60.0140.00717.03
7.2.50.0150.00416.90
7.2.40.0150.00317.08
7.2.30.0060.00916.94
7.2.20.0140.00317.21
7.2.10.0100.00716.84
7.2.00.0070.01418.41
7.1.250.0090.00915.93
7.1.200.0080.00816.03
7.1.100.0000.01018.30
7.1.70.0040.00417.56
7.1.60.0100.01319.70
7.1.50.0070.01717.07
7.1.00.0070.07322.63
7.0.200.0020.00516.84
7.0.140.0000.07722.29
7.0.110.0170.07320.07
7.0.100.0070.07720.14
7.0.90.0030.06720.04
7.0.80.0030.04320.17
7.0.70.0100.04320.01
7.0.60.0030.04320.09
7.0.50.0070.04320.61
7.0.40.0070.03720.03
7.0.30.0000.05320.15
7.0.20.0100.07320.29
7.0.10.0070.04320.23
7.0.00.0130.03020.13
5.6.280.0030.07321.19
5.6.250.0100.06020.83
5.6.240.0100.04720.72
5.6.230.0100.03720.72
5.6.220.0000.04320.99
5.6.210.0030.04020.67
5.6.200.0030.04021.26
5.6.190.0070.04021.03
5.6.180.0030.04321.09
5.6.170.0100.07321.13
5.6.160.0130.06321.40
5.6.150.0070.07321.42
5.6.140.0030.08021.05
5.6.130.0070.05021.12
5.6.120.0070.04021.25
5.6.110.0100.04021.12
5.6.100.0170.06021.30
5.6.90.0000.04721.21
5.6.80.0030.04320.64
5.6.70.0030.04720.43
5.6.60.0070.05720.77
5.6.50.0070.03720.51
5.6.40.0070.03720.76
5.6.30.0000.04020.59
5.6.20.0000.04320.77
5.6.10.0130.04020.41
5.6.00.0100.07720.71
5.5.380.0070.04720.49
5.5.370.0070.03720.64
5.5.360.0030.04020.50
5.5.350.0030.05320.54
5.5.340.0000.04321.09
5.5.330.0070.03721.06
5.5.320.0230.06020.87
5.5.310.0170.03321.15
5.5.300.0000.08021.08
5.5.290.0030.06321.01
5.5.280.0000.04721.15
5.5.270.0070.04021.14
5.5.260.0030.04320.80
5.5.250.0070.03720.62
5.5.240.0100.03320.47
5.5.230.0030.04020.18
5.5.220.0030.03720.45
5.5.210.0070.03720.53
5.5.200.0100.03020.42
5.5.190.0030.06020.44
5.5.180.0030.04320.30
5.5.160.0000.03720.48
5.5.150.0070.04720.32
5.5.140.0070.08020.38
5.5.130.0030.07720.23
5.5.120.0070.08020.40
5.5.110.0070.07720.38
5.5.100.0170.06720.33
5.5.90.0130.07320.36
5.5.80.0170.05720.28
5.5.70.0030.08320.06
5.5.60.0070.04720.23
5.5.50.0070.04320.29
5.5.40.0000.08320.36
5.5.30.0030.08320.38
5.5.20.0100.08020.39
5.5.10.0100.07320.11
5.5.00.0130.06720.11
5.4.450.0070.04719.44
5.4.440.0100.04719.43
5.4.430.0030.05719.55
5.4.420.0000.04319.52
5.4.410.0130.03019.43
5.4.400.0070.03719.46
5.4.390.0130.02719.06
5.4.380.0070.07019.45
5.4.370.0030.04019.41
5.4.360.0030.04019.24
5.4.350.0000.04019.25
5.4.340.0000.05019.08
5.4.320.0100.03319.37
5.4.310.0030.03719.26
5.4.300.0130.06719.38
5.4.290.0000.07319.05
5.4.280.0100.05319.02
5.4.270.0100.07319.41
5.4.260.0100.04319.26
5.4.250.0130.07319.38
5.4.240.0000.08319.10
5.4.230.0030.08019.46
5.4.220.0070.07019.27
5.4.210.0000.08719.19
5.4.200.0100.07719.08
5.4.190.0130.06019.05
5.4.180.0200.06319.27
5.4.170.0130.07019.22
5.4.160.0100.07319.09
5.4.150.0100.07019.06
5.4.140.0130.05716.88
5.4.130.0030.04316.62
5.4.120.0100.05316.44
5.4.110.0030.06316.39
5.4.100.0070.06716.57
5.4.90.0070.07716.80
5.4.80.0070.07016.62
5.4.70.0070.07316.75
5.4.60.0070.07016.62
5.4.50.0030.06016.61
5.4.40.0200.06016.74
5.4.30.0030.07716.74
5.4.20.0130.06316.51
5.4.10.0100.06716.46
5.4.00.0030.07016.25
5.3.290.0070.05314.95
5.3.280.0130.06314.78
5.3.270.0070.07714.85
5.3.260.0030.04714.79
5.3.250.0070.07314.79
5.3.240.0070.07014.81
5.3.230.0130.06714.81
5.3.220.0100.04014.77
5.3.210.0000.04714.65
5.3.200.0000.04714.66
5.3.190.0030.06714.77
5.3.180.0100.06314.80
5.3.170.0030.08014.71
5.3.160.0170.04714.74
5.3.150.0130.06314.79
5.3.140.0000.08314.68
5.3.130.0100.07714.64
5.3.120.0100.05314.64
5.3.110.0030.05014.84
5.3.100.0070.05314.24
5.3.90.0070.08014.30
5.3.80.0070.07714.13
5.3.70.0070.07714.19
5.3.60.0100.06714.19
5.3.50.0070.06714.17
5.3.40.0100.04014.16
5.3.30.0100.06714.08
5.3.20.0100.07013.92
5.3.10.0130.06313.75
5.3.00.0070.07013.83
5.2.170.0030.07711.48
5.2.160.0000.03711.39
5.2.150.0070.06011.24
5.2.140.0070.06311.32
5.2.130.0070.05711.33
5.2.120.0000.06311.32
5.2.110.0000.06011.43
5.2.100.0000.06711.27
5.2.90.0100.05311.18
5.2.80.0100.05711.42
5.2.70.0100.06011.31
5.2.60.0070.06011.38
5.2.50.0030.05311.24
5.2.40.0130.05011.09
5.2.30.0070.05711.07
5.2.20.0100.05311.14
5.2.10.0100.05711.10
5.2.00.0030.04310.82
5.1.60.0070.05310.15
5.1.50.0030.05310.08
5.1.40.0030.05710.14
5.1.30.0030.05710.55
5.1.20.0030.05710.45
5.1.10.0130.04710.26
5.1.00.0100.05010.34
5.0.50.0070.0478.54
5.0.40.0000.0338.68
5.0.30.0100.0608.21
5.0.20.0130.0338.21
5.0.10.0030.0408.37
5.0.00.0000.0608.21
4.4.90.0000.0338.21
4.4.80.0100.0308.21
4.4.70.0030.0208.21
4.4.60.0000.0378.21
4.4.50.0070.0338.21
4.4.40.0130.0338.21
4.4.30.0030.0338.21
4.4.20.0070.0178.21
4.4.10.0000.0378.21
4.4.00.0000.0538.21
4.3.110.0070.0308.21
4.3.100.0030.0338.21
4.3.90.0000.0338.21
4.3.80.0130.0378.21
4.3.70.0000.0378.21
4.3.60.0000.0308.21
4.3.50.0070.0338.21
4.3.40.0000.0538.21
4.3.30.0000.0378.21
4.3.20.0030.0338.21
4.3.10.0030.0338.21
4.3.00.0030.0308.21

preferences:
63.47 ms | 401 KiB | 5 Q