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.60.0120.00917.34
8.3.50.0100.01016.95
8.3.40.0120.00919.47
8.3.30.0120.00319.17
8.3.20.0100.00719.19
8.3.10.0000.00821.02
8.3.00.0060.00319.76
8.2.180.0150.00017.25
8.2.170.0110.00622.96
8.2.160.0140.00020.64
8.2.150.0050.00324.18
8.2.140.0000.00724.66
8.2.130.0000.00826.16
8.2.120.0060.00320.32
8.2.110.0080.00321.43
8.2.100.0080.00418.22
8.2.90.0050.00519.73
8.2.80.0080.00421.24
8.2.70.0050.00318.22
8.2.60.0030.00518.05
8.2.50.0030.00718.13
8.2.40.0060.00318.38
8.2.30.0040.00418.34
8.2.20.0040.00418.13
8.2.10.0040.00418.18
8.2.00.0050.00518.28
8.1.280.0120.00325.92
8.1.270.0070.00724.66
8.1.260.0090.00026.35
8.1.250.0030.00528.09
8.1.240.0060.00320.98
8.1.230.0040.00721.33
8.1.220.0050.00318.04
8.1.210.0050.00319.29
8.1.200.0070.00317.72
8.1.190.0040.00417.89
8.1.180.0050.00318.10
8.1.170.0040.00419.27
8.1.160.0000.00719.23
8.1.150.0030.00619.11
8.1.140.0030.00517.93
8.1.130.0030.00318.13
8.1.120.0040.00417.96
8.1.110.0040.00417.80
8.1.100.0000.00717.84
8.1.90.0070.00017.78
8.1.80.0040.00417.93
8.1.70.0030.00317.81
8.1.60.0000.00818.02
8.1.50.0080.00017.86
8.1.40.0060.00317.77
8.1.30.0030.00617.91
8.1.20.0120.00017.98
8.1.10.0000.00917.95
8.1.00.0040.00417.95
8.0.300.0000.00820.29
8.0.290.0080.00017.25
8.0.280.0030.00318.68
8.0.270.0080.00017.55
8.0.260.0040.00417.28
8.0.250.0000.00817.46
8.0.240.0080.00017.34
8.0.230.0050.00217.33
8.0.220.0030.00317.28
8.0.210.0040.00417.39
8.0.200.0030.00317.30
8.0.190.0080.00017.43
8.0.180.0050.00317.34
8.0.170.0030.00517.42
8.0.160.0000.00817.39
8.0.150.0030.00617.20
8.0.140.0040.00417.30
8.0.130.0060.00013.73
8.0.120.0040.00417.37
8.0.110.0030.00617.41
8.0.100.0040.00417.18
8.0.90.0000.00717.26
8.0.80.0090.00617.32
8.0.70.0080.00017.16
8.0.60.0000.00717.42
8.0.50.0050.00317.38
8.0.30.0070.01217.50
8.0.20.0070.01317.58
8.0.10.0050.00317.52
8.0.00.0060.01317.12
7.4.330.0050.00013.41
7.4.320.0000.00716.97
7.4.300.0030.00317.03
7.4.290.0040.00417.01
7.4.280.0030.00617.08
7.4.270.0090.00017.13
7.4.260.0030.00313.75
7.4.250.0060.00317.02
7.4.240.0040.00417.18
7.4.230.0050.00317.01
7.4.220.0120.00917.13
7.4.210.0090.00817.06
7.4.200.0000.00817.12
7.4.190.0000.00717.15
7.4.160.0090.01217.08
7.4.150.0100.00717.04
7.4.140.0040.01517.04
7.4.130.0090.00816.90
7.4.120.0080.01417.02
7.4.110.0130.00316.89
7.4.100.0140.00317.04
7.4.90.0160.00616.86
7.4.80.0090.01217.03
7.4.70.0140.01017.05
7.4.60.0140.00717.13
7.4.50.0050.00317.05
7.4.40.0000.00916.84
7.4.30.0140.00716.79
7.4.10.0070.01417.05
7.4.00.0050.01315.95
7.3.330.0000.00613.86
7.3.320.0030.00313.68
7.3.310.0030.00316.72
7.3.300.0050.00216.75
7.3.290.0120.00416.84
7.3.280.0100.00516.81
7.3.270.0110.01417.05
7.3.260.0130.01016.84
7.3.250.0100.01216.95
7.3.240.0070.01017.10
7.3.230.0140.00317.19
7.3.210.0080.01016.94
7.3.200.0180.00019.39
7.3.190.0120.00916.86
7.3.180.0060.01117.05
7.3.170.0110.00716.96
7.3.160.0100.00717.11
7.3.130.0130.00716.94
7.3.120.0090.00915.83
7.3.110.0070.01016.06
7.3.100.0060.00716.07
7.3.90.0080.00516.03
7.3.80.0050.01016.06
7.3.70.0030.00916.02
7.3.60.0080.00715.98
7.3.50.0050.00816.03
7.3.40.0080.01016.02
7.3.30.0110.00516.03
7.3.20.0080.00717.83
7.3.10.0050.00717.78
7.3.00.0030.00817.78
7.2.330.0120.00617.00
7.2.320.0130.01017.18
7.2.310.0070.01417.15
7.2.300.0110.00717.05
7.2.290.0110.01116.96
7.2.260.0140.00717.07
7.2.250.0060.01316.32
7.2.240.0080.01216.20
7.2.230.0060.00616.17
7.2.220.0020.00916.19
7.2.210.0010.01316.32
7.2.200.0050.00816.21
7.2.190.0080.00716.30
7.2.180.0030.01016.26
7.2.170.0100.00816.12
7.2.160.0030.01516.77
7.2.150.0100.00718.73
7.2.140.0080.01118.89
7.2.130.0060.00918.81
7.2.120.0000.01518.77
7.2.110.0100.00618.69
7.2.100.0030.01318.84
7.2.90.0070.01118.86
7.2.80.0070.01118.62
7.2.70.0090.00918.94
7.2.60.0090.00717.95
7.2.50.0150.00418.90
7.2.40.0080.00418.89
7.2.30.0070.01118.91
7.2.20.0000.01518.86
7.2.10.0030.01018.79
7.2.00.0400.00818.23
7.1.330.0040.01017.03
7.1.320.0090.00216.84
7.1.310.0080.00516.86
7.1.300.0050.00816.89
7.1.290.0050.01016.87
7.1.280.0020.01016.87
7.1.270.0080.00816.81
7.1.260.0040.01116.92
7.1.250.0040.01117.73
7.1.240.0100.00717.91
7.1.230.0060.00617.83
7.1.220.0130.00317.87
7.1.210.0040.01117.62
7.1.200.0070.00916.74
7.1.190.0100.00017.75
7.1.180.0040.00717.93
7.1.170.0070.01017.66
7.1.160.0000.01617.82
7.1.150.0070.00717.64
7.1.140.0070.01017.81
7.1.130.0140.00317.70
7.1.120.0070.01317.73
7.1.110.0070.00717.68
7.1.100.0020.00918.21
7.1.90.0110.00317.90
7.1.80.0070.00717.75
7.1.70.0050.00917.62
7.1.60.0100.00718.61
7.1.50.0040.01617.48
7.1.40.0080.00417.69
7.1.30.0040.00817.63
7.1.20.0040.00817.83
7.1.10.0000.01417.83
7.1.00.0070.04020.19
7.0.330.0100.00017.43
7.0.320.0060.00617.51
7.0.310.0000.01217.49
7.0.300.0040.00717.50
7.0.290.0040.01117.45
7.0.280.0040.00717.64
7.0.270.0030.01217.52
7.0.260.0080.00617.31
7.0.250.0070.00717.47
7.0.240.0060.00617.57
7.0.230.0000.01517.55
7.0.220.0000.01617.57
7.0.210.0030.00917.49
7.0.200.0070.00417.19
7.0.190.0040.00817.63
7.0.180.0090.00617.44
7.0.170.0040.00817.65
7.0.160.0030.00917.31
7.0.150.0030.00617.59
7.0.140.0000.04519.81
7.0.130.0030.01217.40
7.0.120.0100.03819.81
7.0.110.0120.00317.54
7.0.100.0050.00817.59
7.0.90.0070.00417.52
7.0.80.0100.00317.27
7.0.70.0040.00817.48
7.0.60.0050.02518.80
7.0.50.0050.02417.69
7.0.40.0080.04817.86
7.0.30.0060.04917.84
7.0.20.0060.04917.89
7.0.10.0100.04517.99
7.0.00.0070.04717.86
5.6.400.0030.00716.03
5.6.390.0040.00816.05
5.6.380.0100.00316.69
5.6.370.0060.01216.20
5.6.360.0060.01016.25
5.6.350.0050.00516.44
5.6.340.0000.01316.39
5.6.330.0090.00916.08
5.6.320.0000.01116.50
5.6.310.0090.00316.29
5.6.300.0040.00716.23
5.6.290.0110.00416.39
5.6.280.0110.04618.85
5.6.270.0070.01316.41
5.6.260.0130.00316.39
5.6.250.0070.00716.38
5.6.240.0060.01216.57
5.6.230.0120.00816.21
5.6.220.0030.01016.41
5.6.210.0060.02318.52
5.6.200.0050.02617.43
5.6.190.0070.04818.46
5.6.180.0080.04518.47
5.6.170.0040.04918.56
5.6.160.0110.03118.43
5.6.150.0090.04718.44
5.6.140.0080.02818.37
5.6.130.0070.03818.48
5.6.120.0070.04318.50
5.6.110.0030.04218.37
5.6.100.0080.04318.27
5.6.90.0020.04218.42
5.6.80.0030.04918.19
5.6.70.0050.02718.08
5.6.60.0110.02018.03
5.6.50.0050.04517.95
5.6.40.0060.04318.11
5.6.30.0070.03018.07
5.6.20.0090.03817.99
5.6.10.0050.04718.00
5.6.00.0120.04318.13
5.5.380.0060.00916.27
5.5.370.0040.01416.16
5.5.360.0000.01116.24
5.5.350.0110.03818.38
5.5.340.0070.02717.19
5.5.330.0070.04718.30
5.5.320.0080.03018.32
5.5.310.0110.04318.28
5.5.300.0060.02218.24
5.5.290.0070.03818.12
5.5.280.0070.03918.17
5.5.270.0100.03518.18
5.5.260.0140.03818.26
5.5.250.0110.03818.11
5.5.240.0070.03917.93
5.5.230.0060.03318.08
5.5.220.0060.02817.78
5.5.210.0030.03117.88
5.5.200.0080.04517.99
5.5.190.0070.04417.79
5.5.180.0070.03217.89
5.5.170.0070.01016.35
5.5.160.0120.04117.95
5.5.150.0110.04117.79
5.5.140.0090.04318.10
5.5.130.0070.04217.99
5.5.120.0060.02617.71
5.5.110.0060.03317.79
5.5.100.0070.02217.96
5.5.90.0050.02717.89
5.5.80.0050.04417.88
5.5.70.0070.02717.72
5.5.60.0090.03917.85
5.5.50.0050.04517.87
5.5.40.0080.02617.96
5.5.30.0070.02317.71
5.5.20.0080.03617.74
5.5.10.0080.02717.78
5.5.00.0120.03817.85
5.4.450.0060.03616.30
5.4.440.0070.03316.33
5.4.430.0170.02316.43
5.4.420.0100.03816.32
5.4.410.0100.03416.04
5.4.400.0140.03316.19
5.4.390.0050.02816.06
5.4.380.0030.02916.06
5.4.370.0060.02116.07
5.4.360.0030.04016.20
5.4.350.0050.03616.02
5.4.340.0080.03715.86
5.4.330.0060.00912.72
5.4.320.0030.04116.07
5.4.310.0080.02515.95
5.4.300.0050.02715.83
5.4.290.0100.03716.05
5.4.280.0050.02515.83
5.4.270.0100.02816.13
5.4.260.0110.01815.90
5.4.250.0030.02315.99
5.4.240.0100.03216.12
5.4.230.0100.03915.89
5.4.220.0010.02416.17
5.4.210.0040.02016.16
5.4.200.0050.03216.08
5.4.190.0030.02316.13
5.4.180.0050.02316.29
5.4.170.0030.03015.97
5.4.160.0120.03516.05
5.4.150.0100.03816.04
5.4.140.0060.03814.83
5.4.130.0090.03514.66
5.4.120.0080.03814.88
5.4.110.0070.02314.69
5.4.100.0030.02914.75
5.4.90.0070.02814.65
5.4.80.0030.03314.65
5.4.70.0050.03914.69
5.4.60.0050.02314.84
5.4.50.0080.02014.78
5.4.40.0080.03614.73
5.4.30.0070.03814.68
5.4.20.0020.04014.66
5.4.10.0090.03814.89
5.4.00.0050.03514.38
5.3.290.0110.04314.19
5.3.280.0020.03414.00
5.3.270.0030.04314.04
5.3.260.0070.04014.00
5.3.250.0130.03514.05
5.3.240.0100.02314.08
5.3.230.0070.03214.06
5.3.220.0010.04614.15
5.3.210.0070.04014.10
5.3.200.0050.04114.01
5.3.190.0090.03814.04
5.3.180.0020.03614.14
5.3.170.0110.03514.15
5.3.160.0070.03714.12
5.3.150.0050.02814.11
5.3.140.0070.04114.22
5.3.130.0070.03014.20
5.3.120.0100.03814.15
5.3.110.0030.03014.04
5.3.100.0030.04313.84
5.3.90.0080.02613.90
5.3.80.0050.02713.66
5.3.70.0050.02813.68
5.3.60.0020.02613.85
5.3.50.0090.03613.82
5.3.40.0050.04213.76
5.3.30.0120.03413.81
5.3.20.0030.03813.65
5.3.10.0080.02113.51
5.3.00.0070.02213.46
5.2.170.0070.04311.40
5.2.160.0100.05311.29
5.2.150.0030.04711.38
5.2.140.0030.06311.32
5.2.130.0070.05711.28
5.2.120.0070.05711.36
5.2.110.0070.03711.31
5.2.100.0000.03011.25
5.2.90.0000.03011.12
5.2.80.0030.03011.28
5.2.70.0000.03011.28
5.2.60.0000.03011.12
5.2.50.0070.02711.25
5.2.40.0070.02311.16
5.2.30.0030.03311.02
5.2.20.0070.02311.21
5.2.10.0000.03011.11
5.2.00.0000.03310.88
5.1.60.0030.02310.16
5.1.50.0070.02010.11
5.1.40.0000.02310.18
5.1.30.0000.02710.48
5.1.20.0030.02310.52
5.1.10.0030.02310.14
5.1.00.0030.02710.25
5.0.50.0030.0178.73
5.0.40.0000.0208.34
5.0.30.0030.0308.15
5.0.20.0070.0138.25
5.0.10.0030.0178.17
5.0.00.0000.0308.25
4.4.90.0000.0176.23
4.4.80.0070.0106.23
4.4.70.0000.0176.23
4.4.60.0000.0176.23
4.4.50.0030.0136.23
4.4.40.0000.0236.23
4.4.30.0000.0176.23
4.4.20.0000.0176.23
4.4.10.0030.0136.23
4.4.00.0000.0236.23
4.3.110.0000.0176.23
4.3.100.0030.0106.23
4.3.90.0030.0106.23
4.3.80.0000.0236.23
4.3.70.0000.0136.23
4.3.60.0030.0106.23
4.3.50.0030.0136.23
4.3.40.0000.0236.23
4.3.30.0000.0136.23
4.3.20.0000.0136.23
4.3.10.0000.0136.23
4.3.00.0000.0136.23

preferences:
55.13 ms | 400 KiB | 5 Q