3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; private $filePath; private $isUrl; 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 ($this->xml->$offset->count() > 1) { return new self($this->xml->$offset->asXML(), false); } var_dump($this->xml->$offset->asXML()); return $this->xml->$offset; } 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($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.0210.00017.00
8.3.50.0130.00516.89
8.3.40.0140.00019.25
8.3.30.0070.00719.09
8.3.20.0080.00019.06
8.3.10.0040.00420.98
8.3.00.0090.00319.63
8.2.180.0130.00816.75
8.2.170.0030.01322.96
8.2.160.0120.00321.38
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00320.33
8.2.110.0090.00021.11
8.2.100.0040.00818.09
8.2.90.0000.01021.18
8.2.80.0030.00618.18
8.2.70.0080.00317.75
8.2.60.0080.00018.29
8.2.50.0030.00618.07
8.2.40.0050.00318.30
8.2.30.0040.00418.41
8.2.20.0000.00817.96
8.2.10.0040.00418.03
8.2.00.0000.00918.15
8.1.280.0150.00325.92
8.1.270.0030.00524.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00420.95
8.1.230.0070.00421.22
8.1.220.0000.00817.93
8.1.210.0080.00019.27
8.1.200.0030.00617.63
8.1.190.0030.00517.91
8.1.180.0040.00418.10
8.1.170.0030.00519.00
8.1.160.0000.00819.06
8.1.150.0030.00518.77
8.1.140.0080.00417.59
8.1.130.0070.00017.97
8.1.120.0050.00217.75
8.1.110.0050.00217.70
8.1.100.0040.00317.59
8.1.90.0050.00317.72
8.1.80.0020.00517.76
8.1.70.0000.00817.65
8.1.60.0030.00517.82
8.1.50.0000.00817.75
8.1.40.0000.00817.79
8.1.30.0060.00317.83
8.1.20.0080.00017.85
8.1.10.0000.00817.87
8.1.00.0000.00817.71
8.0.300.0050.00320.26
8.0.290.0070.00016.88
8.0.280.0040.00418.64
8.0.270.0050.00317.48
8.0.260.0050.00517.00
8.0.250.0000.00717.10
8.0.240.0000.00817.24
8.0.230.0070.00017.10
8.0.220.0040.00417.20
8.0.210.0030.00317.20
8.0.200.0070.00017.19
8.0.190.0080.00017.23
8.0.180.0040.00417.07
8.0.170.0000.00817.18
8.0.160.0050.00317.03
8.0.150.0030.00617.09
8.0.140.0050.00617.08
8.0.130.0000.00613.46
8.0.120.0040.00417.04
8.0.110.0040.00417.04
8.0.100.0000.00817.12
8.0.90.0050.00217.22
8.0.80.0000.01517.11
8.0.70.0040.00416.97
8.0.60.0040.00417.04
8.0.50.0000.00817.04
8.0.30.0080.01117.34
8.0.20.0120.01117.19
8.0.10.0040.00417.12
8.0.00.0080.01016.99
7.4.330.0030.00313.29
7.4.320.0050.00216.71
7.4.300.0050.00216.91
7.4.290.0000.00716.78
7.4.280.0030.00616.77
7.4.270.0000.00716.71
7.4.260.0000.00513.50
7.4.250.0030.00616.74
7.4.240.0000.00716.91
7.4.230.0000.00716.87
7.4.220.0190.00616.88
7.4.210.0080.00916.90
7.4.200.0000.00716.88
7.4.190.0050.00316.95
7.4.160.0150.00316.46
7.4.150.0120.00616.76
7.4.140.0080.01316.84
7.4.130.0080.01116.94
7.4.120.0110.00716.69
7.4.110.0090.01216.81
7.4.100.0070.01116.75
7.4.90.0110.00916.82
7.4.80.0120.00616.64
7.4.70.0000.01716.77
7.4.60.0110.00916.84
7.4.50.0000.00816.64
7.4.40.0060.00616.93
7.4.30.0070.01016.91
7.4.00.0060.00914.90
7.3.330.0000.00613.68
7.3.320.0000.00513.54
7.3.310.0000.00716.64
7.3.300.0030.00316.70
7.3.290.0090.00616.69
7.3.280.0140.00616.63
7.3.270.0100.00716.79
7.3.260.0100.01016.77
7.3.250.0060.01416.69
7.3.240.0030.01316.68
7.3.230.0130.01016.84
7.3.210.0130.00316.87
7.3.200.0100.01019.39
7.3.190.0060.01216.98
7.3.180.0160.00616.88
7.3.170.0060.00916.88
7.3.160.0100.00716.97
7.3.120.0100.00714.88
7.3.110.0040.01214.94
7.3.100.0070.00514.97
7.3.90.0030.01214.98
7.3.80.0130.00114.89
7.3.70.0070.00915.01
7.3.60.0070.00614.83
7.3.50.0050.01115.03
7.3.40.0070.00414.81
7.3.30.0080.00714.95
7.3.20.0030.01016.72
7.3.10.0080.00816.66
7.3.00.0050.00916.78
7.2.330.0030.01417.03
7.2.320.0090.00916.88
7.2.310.0090.00916.99
7.2.300.0080.01116.82
7.2.290.0170.00716.93
7.2.250.0030.01615.34
7.2.240.0040.01115.32
7.2.230.0070.01015.23
7.2.220.0110.00515.17
7.2.210.0080.00515.28
7.2.200.0100.00515.15
7.2.190.0090.00515.23
7.2.180.0100.00415.19
7.2.170.0070.00415.20
7.2.160.0000.01115.41
7.2.150.0030.00917.23
7.2.140.0040.00817.07
7.2.130.0000.01517.11
7.2.120.0060.00616.95
7.2.110.0060.00917.09
7.2.100.0060.00617.05
7.2.90.0100.00617.04
7.2.80.0180.00017.36
7.2.70.0030.00917.04
7.2.60.0060.00816.97
7.2.50.0200.00716.95
7.2.40.0040.00917.01
7.2.30.0070.01117.13
7.2.20.0030.00916.95
7.2.10.0100.00716.86
7.2.00.0040.01517.15
7.1.330.0040.00915.92
7.1.320.0080.00716.01
7.1.310.0060.00815.76
7.1.300.0070.00715.88
7.1.290.0070.00815.95
7.1.280.0020.01115.85
7.1.270.0060.00915.94
7.1.260.0070.00915.87
7.1.250.0070.01115.99
7.1.200.0000.01615.69
7.1.70.0030.01017.40
7.1.60.0110.01419.40
7.1.50.0100.01317.18
7.1.00.0130.06322.38
7.0.200.0040.00416.95
7.0.140.0030.06722.14
7.0.120.0070.06022.16
7.0.60.0000.04720.02
7.0.50.0000.04318.07
7.0.40.0130.07020.45
7.0.30.0270.07020.32
7.0.20.0170.04720.30
7.0.10.0300.07720.32
7.0.00.0130.04720.33
5.6.280.0030.07021.06
5.6.210.0100.07320.65
5.6.200.0000.04318.30
5.6.190.0000.04320.57
5.6.180.0470.06320.41
5.6.170.0370.07320.63
5.6.160.0070.04720.78
5.6.150.0030.05318.23
5.6.140.0100.08018.36
5.6.130.0000.08318.34
5.6.120.0030.05721.04
5.6.110.0030.07321.05
5.6.100.0100.08321.21
5.6.90.0100.06721.06
5.6.80.0100.07320.56
5.6.70.4370.04720.46
5.5.350.0270.06020.50
5.5.340.0100.08018.14
5.5.330.0100.04320.56
5.5.320.0300.05320.61
5.5.310.0330.06020.34
5.5.300.0070.07718.03
5.5.290.0100.04018.12
5.5.280.0030.07320.89
5.5.270.0070.04020.85
5.5.260.0070.07720.83
5.5.250.0130.06720.68
5.5.240.0000.04020.38
5.4.450.0070.08719.46
5.4.440.0030.05319.63
5.4.430.0030.05019.55
5.4.420.0030.07019.62
5.4.410.0030.06719.49
5.4.400.0070.07719.30
5.4.390.0030.08019.32
5.4.380.0030.06019.30
5.4.370.0130.05719.42
5.4.360.0100.06319.16
5.4.350.0070.04719.26
5.4.340.0070.07319.30
5.4.320.0070.04719.08
5.4.310.0070.07019.39
5.4.300.0000.07019.13
5.4.290.0070.05719.05
5.4.280.0030.08019.07
5.4.270.0070.07019.07
5.4.260.0000.07719.34
5.4.250.0070.07319.24
5.4.240.0100.04019.29
5.4.230.0000.04319.36
5.4.220.0100.07019.39
5.4.210.0070.07019.20
5.4.200.0100.07319.31
5.4.190.0030.04019.05
5.4.180.0000.04019.23
5.4.170.0000.03719.32
5.4.160.0000.03719.19
5.4.150.0030.03719.34
5.4.140.0000.03716.56
5.4.130.0030.03016.69
5.4.120.0000.03316.64
5.4.110.0030.03316.69
5.4.100.0000.03316.69
5.4.90.0030.03316.68
5.4.80.0000.03716.53
5.4.70.0000.03316.50
5.4.60.0070.04016.51
5.4.50.0000.04316.47
5.4.40.0000.03316.38
5.4.30.0000.03716.46
5.4.20.0030.03016.46
5.4.10.0030.03016.35
5.4.00.0030.07316.03
5.3.290.0000.06014.76
5.3.280.0070.04714.67
5.3.270.0030.03714.70
5.3.260.0030.04014.78
5.3.250.0000.04014.82
5.3.240.0030.03314.78
5.3.230.0000.04314.66
5.3.220.0000.04014.67
5.3.210.0100.02714.64
5.3.200.0000.03714.66
5.3.190.0100.03314.63
5.3.180.0000.04014.63
5.3.170.0000.04314.63
5.3.160.0000.03714.63
5.3.150.0000.03714.62
5.3.140.0000.03714.64
5.3.130.0000.04314.61
5.3.120.0000.04314.62
5.3.110.0030.03314.72
5.3.100.0000.03714.24
5.3.90.0070.03014.10
5.3.80.0000.03314.12
5.3.70.0000.03314.02
5.3.60.0030.03314.32
5.3.50.0070.03014.13
5.3.40.0030.03314.01
5.3.30.0000.03713.98
5.3.20.0030.03713.87
5.3.10.0000.04013.66
5.3.00.0030.03313.74
5.2.170.0000.03011.42
5.2.160.0000.03011.18
5.2.150.0000.03011.21
5.2.140.0000.03011.20
5.2.130.0000.02711.28
5.2.120.0030.02311.15
5.2.110.0030.03011.16
5.2.100.0000.02711.36
5.2.90.0030.03711.38
5.2.80.0030.05011.32
5.2.70.0000.06011.18
5.2.60.0070.05711.37
5.2.50.0030.05011.11
5.2.40.0030.06311.18
5.2.30.0070.06011.03
5.2.20.0030.06011.04
5.2.10.0030.03011.00
5.2.00.0000.06011.00
5.1.60.0070.04311.00
5.1.50.0000.03711.03
5.1.40.0000.04311.03
5.1.30.0070.06311.04
5.1.20.0100.04711.04
5.1.10.0030.05711.05
5.1.00.0000.05011.05
5.0.50.0030.03311.06
5.0.40.0000.05011.07
5.0.30.0030.03311.07
5.0.20.0000.04311.08
5.0.10.0030.04311.11
5.0.00.0030.04011.13
4.4.90.0070.03010.96
4.4.80.0030.03710.96
4.4.70.0030.01710.98
4.4.60.0070.02310.99
4.4.50.0100.01011.00
4.4.40.0030.02711.02
4.4.30.0000.01711.03
4.4.20.0070.02311.04
4.4.10.0000.02311.06
4.4.00.0030.04011.07
4.3.110.0070.02711.07
4.3.100.0070.01311.07
4.3.90.0000.02011.10
4.3.80.0000.03011.14
4.3.70.0100.02311.14
4.3.60.0030.03311.14
4.3.50.0000.03711.15
4.3.40.0030.05311.16
4.3.30.0000.03711.16
4.3.20.0000.03011.17
4.3.10.0000.03311.18
4.3.00.0000.03311.18

preferences:
37.92 ms | 401 KiB | 5 Q