3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; private $current; 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; } //$this->current = $this->xml->$offset; return $this->current = new self($this->xml->$offset->asXML(), false); } public function __toString() { var_dump($this->current); return (string) $this->current; } 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']; //var_dump((string)$xml['note']['recursive']);

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.00616.88
8.3.50.0120.01022.30
8.3.40.0100.01019.18
8.3.30.0040.01119.18
8.3.20.0060.00320.59
8.3.10.0110.00723.70
8.3.00.0130.00721.02
8.2.180.0040.01217.13
8.2.170.0120.00922.96
8.2.160.0100.01020.53
8.2.150.0030.00624.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0130.00322.55
8.2.110.0030.00720.81
8.2.100.0090.00318.28
8.2.90.0040.00419.52
8.2.80.0060.00318.18
8.2.70.0090.00017.88
8.2.60.0040.00418.18
8.2.50.0000.01218.07
8.2.40.0080.00018.42
8.2.30.0050.00318.43
8.2.20.0000.00818.02
8.2.10.0040.00418.10
8.2.00.0040.00418.12
8.1.280.0040.01125.92
8.1.270.0040.00423.89
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00424.06
8.1.230.0110.00023.95
8.1.220.0000.00917.88
8.1.210.0080.00018.77
8.1.200.0040.00417.48
8.1.190.0000.00817.66
8.1.180.0050.00318.10
8.1.170.0040.00418.84
8.1.160.0040.00422.29
8.1.150.0070.00018.83
8.1.140.0080.00017.59
8.1.130.0000.00718.11
8.1.120.0020.00517.67
8.1.110.0040.00417.78
8.1.100.0070.00417.69
8.1.90.0000.00717.78
8.1.80.0030.00317.79
8.1.70.0070.00017.61
8.1.60.0060.00317.75
8.1.50.0050.00317.77
8.1.40.0000.00717.71
8.1.30.0040.00417.75
8.1.20.0040.00417.96
8.1.10.0030.00517.80
8.1.00.0100.00017.84
8.0.300.0060.00318.77
8.0.290.0050.00217.53
8.0.280.0030.00318.61
8.0.270.0070.00017.53
8.0.260.0070.00017.11
8.0.250.0030.00317.11
8.0.240.0000.00717.18
8.0.230.0070.00017.23
8.0.220.0030.00317.08
8.0.210.0040.00417.18
8.0.200.0080.00017.29
8.0.190.0040.00417.19
8.0.180.0000.00717.12
8.0.170.0000.00817.11
8.0.160.0000.00717.04
8.0.150.0000.00817.14
8.0.140.0040.00417.02
8.0.130.0030.00313.57
8.0.120.0050.00317.04
8.0.110.0040.00417.09
8.0.100.0000.00817.19
8.0.90.0000.00817.12
8.0.80.0040.01217.18
8.0.70.0030.00516.99
8.0.60.0030.00717.20
8.0.50.0040.00417.05
8.0.30.0110.01117.62
8.0.20.0080.01117.48
8.0.10.0050.00317.29
8.0.00.0080.01316.99
7.4.330.0020.00215.38
7.4.320.0070.00016.75
7.4.300.0000.00616.84
7.4.290.0080.00016.82
7.4.280.0000.00716.76
7.4.270.0040.00416.89
7.4.260.0030.00316.87
7.4.250.0000.00816.73
7.4.240.0000.00716.81
7.4.230.0030.00316.79
7.4.220.0120.00616.86
7.4.210.0060.01016.84
7.4.200.0070.00016.82
7.4.190.0070.00016.66
7.4.160.0080.00816.52
7.4.150.0200.00017.40
7.4.140.0100.01117.86
7.4.130.0040.01216.87
7.4.120.0090.00816.92
7.4.110.0100.00716.81
7.4.100.0070.01116.73
7.4.90.0120.00616.85
7.4.80.0110.00619.39
7.4.70.0030.01516.74
7.4.60.0070.01016.87
7.4.50.0030.00316.91
7.4.40.0090.00622.77
7.4.30.0210.00016.72
7.4.00.0050.01215.09
7.3.330.0030.00313.50
7.3.320.0040.00413.64
7.3.310.0000.00816.54
7.3.300.0070.00016.65
7.3.290.0030.01316.56
7.3.280.0110.00716.63
7.3.270.0090.00917.40
7.3.260.0150.00416.58
7.3.250.0130.00516.72
7.3.240.0150.00616.65
7.3.230.0090.00916.88
7.3.210.0060.01216.79
7.3.200.0090.00919.39
7.3.190.0100.01316.93
7.3.180.0060.01216.61
7.3.170.0000.01516.59
7.3.160.0150.00016.57
7.3.120.0070.01015.20
7.3.110.0090.00614.73
7.3.100.0060.01315.10
7.3.90.0000.01415.11
7.3.80.0040.01515.04
7.3.70.0140.00315.04
7.3.60.0000.01214.72
7.3.50.0070.00714.73
7.3.40.0040.00414.89
7.3.30.0090.00614.89
7.3.20.0000.01817.04
7.3.10.0030.01416.97
7.3.00.0060.00616.61
7.2.330.0110.00717.05
7.2.320.0090.00917.07
7.2.310.0060.01316.72
7.2.300.0040.01216.81
7.2.290.0100.00716.95
7.2.250.0040.01415.14
7.2.240.0060.01314.98
7.2.230.0090.00615.44
7.2.220.0030.01015.15
7.2.210.0080.01215.18
7.2.200.0000.01415.29
7.2.190.0070.00815.12
7.2.180.0000.01015.06
7.2.170.0030.01015.38
7.2.160.0090.00615.29
7.2.150.0040.01517.19
7.2.140.0030.00916.93
7.2.130.0070.00717.18
7.2.120.0100.01016.96
7.2.110.0090.00617.02
7.2.100.0070.01317.10
7.2.90.0120.00417.01
7.2.80.0070.00717.21
7.2.70.0100.00617.23
7.2.60.0070.01116.88
7.2.50.0040.01117.06
7.2.40.0100.00316.98
7.2.30.0050.00817.18
7.2.20.0060.00916.96
7.2.10.0040.01116.89
7.2.00.0080.00818.14
7.1.330.0070.01016.10
7.1.320.0040.00716.05
7.1.310.0000.01115.90
7.1.300.0060.00615.85
7.1.290.0000.01315.93
7.1.280.0030.01416.07
7.1.270.0040.01115.93
7.1.260.0030.01015.95
7.1.250.0030.01215.87
7.1.240.0030.01415.91
7.1.230.0000.01516.08
7.1.220.0000.01415.92
7.1.210.0070.00715.80
7.1.200.0090.00615.83
7.1.190.0040.01116.09
7.1.180.0000.01015.95
7.1.170.0100.00316.13
7.1.160.0070.00715.86
7.1.150.0110.00315.97
7.1.140.0090.00316.09
7.1.130.0040.00715.87
7.1.120.0030.00916.08
7.1.110.0080.00415.98
7.1.100.0070.00517.16
7.1.90.0120.00315.95
7.1.80.0040.01415.96
7.1.70.0140.00516.56
7.1.60.0050.01217.70
7.1.50.0090.00616.55
7.1.40.0090.00615.82
7.1.30.0030.01215.74
7.1.20.0070.01015.84
7.1.10.0030.01016.16
7.1.00.0030.04519.21
7.0.330.0060.00615.50
7.0.320.0030.01015.55
7.0.310.0040.01115.62
7.0.300.0030.00615.44
7.0.290.0030.00615.51
7.0.280.0030.00615.37
7.0.270.0030.00615.32
7.0.260.0030.01015.61
7.0.250.0040.00715.52
7.0.240.0000.01515.57
7.0.230.0030.01315.51
7.0.220.0070.01115.82
7.0.210.0040.01215.70
7.0.200.0050.00816.16
7.0.190.0100.00415.45
7.0.180.0060.00915.77
7.0.170.0080.00715.59
7.0.160.0030.00815.57
7.0.150.0070.00315.32
7.0.140.0030.03818.76
7.0.130.0060.00915.58
7.0.120.0060.01215.74
7.0.110.0060.01215.65
7.0.100.0050.03817.89
7.0.90.0030.04817.74
7.0.80.0050.04617.76
7.0.70.0020.04817.79
7.0.60.0090.04117.79
7.0.50.0080.04018.02
7.0.40.0090.04117.14
7.0.30.0070.04917.07
7.0.20.0080.04517.14
7.0.10.0070.04517.16
7.0.00.0100.03717.10
5.6.400.0040.01114.67
5.6.390.0090.00614.66
5.6.380.0140.00014.59
5.6.370.0090.00614.66
5.6.360.0060.00614.75
5.6.350.0120.00314.88
5.6.340.0130.00314.60
5.6.330.0030.00914.27
5.6.320.0030.00714.50
5.6.310.0030.00914.48
5.6.300.0030.01014.63
5.6.290.0040.01114.68
5.6.280.0070.03917.91
5.6.270.0030.01514.67
5.6.260.0030.00714.60
5.6.250.0050.04517.60
5.6.240.0080.04217.54
5.6.230.0060.04517.63
5.6.220.0070.04517.76
5.6.210.0050.03417.56
5.6.200.0060.03017.71
5.6.190.0110.02817.70
5.6.180.0020.04818.03
5.6.170.0020.04917.97
5.6.160.0030.03117.85
5.6.150.0150.03317.90
5.6.140.0020.04817.92
5.6.130.0050.03217.77
5.6.120.0100.03817.77
5.6.110.0100.04217.87
5.6.100.0040.05117.77
5.6.90.0100.03517.89
5.6.80.0090.03917.54
5.6.70.0050.04517.48
5.6.60.0100.04017.54
5.6.50.0090.02217.36
5.6.40.0070.03917.41
5.6.30.0050.04517.39
5.6.20.0080.04217.61
5.6.10.0020.04717.60
5.6.00.0120.03517.53
5.5.380.0080.04217.38
5.5.370.0050.03117.54
5.5.360.0030.03917.45
5.5.350.0050.04517.62
5.5.340.0000.03717.85
5.5.330.0050.04917.60
5.5.320.0020.04717.56
5.5.310.0090.04217.57
5.5.300.0050.04417.80
5.5.290.0030.04317.71
5.5.280.0040.04617.54
5.5.270.0030.03817.63
5.5.260.0020.04517.50
5.5.250.0070.04217.45
5.5.240.0020.04417.15
5.5.230.0060.03017.31
5.5.220.0060.04517.42
5.5.210.0070.04417.24
5.5.200.0060.04117.28
5.5.190.0040.04217.34
5.5.180.0050.02817.14
5.5.170.0080.00814.45
5.5.160.0080.04017.28
5.5.150.0050.04017.37
5.5.140.0070.04217.40
5.5.130.0030.04317.19
5.5.120.0080.03817.32
5.5.110.0060.03817.23
5.5.100.0020.03517.22
5.5.90.0020.04517.41
5.5.80.0140.03817.15
5.5.70.0070.03817.24
5.5.60.0070.04317.12
5.5.50.0030.03017.41
5.5.40.0050.04517.24
5.5.30.0100.03817.21
5.5.20.0100.04017.08
5.5.10.0060.04617.20
5.5.00.0110.03517.26
5.4.450.0100.02516.86
5.4.440.0040.04016.84
5.4.430.0010.04416.83
5.4.420.0080.03716.85
5.4.410.0100.03216.83
5.4.400.0050.04516.52
5.4.390.0080.04116.67
5.4.380.0060.03816.62
5.4.370.0070.03516.60
5.4.360.0030.03816.67
5.4.350.0030.04016.67
5.4.340.0030.04316.68
5.4.330.0030.00614.10
5.4.320.0040.02016.67
5.4.310.0060.04016.56
5.4.300.0050.04416.61
5.4.290.0100.03816.67
5.4.280.0050.04516.68
5.4.270.0050.02316.56
5.4.260.0050.03216.68
5.4.250.0030.02316.71
5.4.240.0070.03716.67
5.4.230.0090.03516.52
5.4.220.0120.03516.69
5.4.210.0080.03716.53
5.4.200.0080.03816.67
5.4.190.0100.03816.69
5.4.180.0030.04216.52
5.4.170.0060.03816.67
5.4.160.0080.04016.73
5.4.150.0020.04716.55
5.4.140.0070.03715.30
5.4.130.0040.04215.33
5.4.120.0020.04715.29
5.4.110.0100.03515.35
5.4.100.0080.03515.33
5.4.90.0070.03315.37
5.4.80.0030.02515.32
5.4.70.0040.02515.35
5.4.60.0000.02615.32
5.4.50.0020.02415.35
5.4.40.0100.01815.27
5.4.30.0050.02015.38
5.4.20.0030.01915.31
5.4.10.0050.02115.38
5.4.00.0030.02015.04
5.3.290.0050.04314.52
5.3.280.0050.04314.44
5.3.270.0070.04014.47
5.3.260.0070.03814.48
5.3.250.0070.03714.39
5.3.240.0100.03614.43
5.3.230.0040.04314.44
5.3.220.0110.03314.38
5.3.210.0110.03314.39
5.3.200.0060.03814.42
5.3.190.0050.02614.41
5.3.180.0020.04314.43
5.3.170.0060.03614.45
5.3.160.0050.02014.41
5.3.150.0020.02314.37
5.3.140.0050.02014.37
5.3.130.0040.02314.37
5.3.120.0000.02614.42
5.3.110.0030.02314.40
5.3.100.0020.02514.19
5.3.90.0020.02514.14
5.3.80.0060.01814.18
5.3.70.0060.01814.20
5.3.60.0050.01714.13
5.3.50.0000.02514.13
5.3.40.0030.02214.02
5.3.30.0040.02014.04
5.3.20.0020.02113.97
5.3.10.0060.02213.97
5.3.00.0030.02013.99
5.2.170.0030.03011.13
5.2.160.0030.06311.38
5.2.150.0030.05311.33
5.2.140.0070.04011.33
5.2.130.0100.05011.33
5.2.120.0070.02711.29
5.2.110.0030.02711.26
5.2.100.0030.03011.29
5.2.90.0030.02711.29
5.2.80.0000.05011.24
5.2.70.0030.04711.36
5.2.60.0030.02711.24
5.2.50.0000.04011.21
5.2.40.0000.04311.15
5.2.30.0100.05311.10
5.2.20.0100.02011.24
5.2.10.0030.02711.15
5.2.00.0030.02710.77
5.1.60.0030.02310.13
5.1.50.0000.02710.27
5.1.40.0000.02710.08
5.1.30.0030.02310.48
5.1.20.0000.02710.43
5.1.10.0000.0279.97
5.1.00.0030.03710.08
5.0.50.0030.0208.60
5.0.40.0030.0178.43
5.0.30.0030.0278.08
5.0.20.0000.0208.31
5.0.10.0030.0208.19
5.0.00.0030.0278.02
4.4.90.0030.0137.73
4.4.80.0070.0277.73
4.4.70.0000.0177.73
4.4.60.0000.0177.73
4.4.50.0000.0177.73
4.4.40.0030.0277.73
4.4.30.0070.0107.73
4.4.20.0000.0177.73
4.4.10.0000.0177.73
4.4.00.0000.0277.73
4.3.110.0000.0177.73
4.3.100.0000.0137.73
4.3.90.0030.0137.73
4.3.80.0000.0277.73
4.3.70.0000.0137.73
4.3.60.0030.0137.73
4.3.50.0000.0177.73
4.3.40.0000.0237.73
4.3.30.0000.0177.73
4.3.20.0000.0177.73
4.3.10.0000.0177.73
4.3.00.0000.0137.73

preferences:
32.37 ms | 401 KiB | 5 Q