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); } 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']; echo $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.0110.00718.81
8.3.50.0160.00618.20
8.3.40.0030.01319.16
8.3.30.0080.00619.34
8.3.20.0080.00020.46
8.3.10.0050.00322.35
8.3.00.0030.00522.55
8.2.180.0070.00717.13
8.2.170.0120.00922.96
8.2.160.0110.00421.24
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0000.00826.16
8.2.120.0040.00419.73
8.2.110.0030.00720.79
8.2.100.0110.00017.91
8.2.90.0000.00819.42
8.2.80.0000.00817.97
8.2.70.0060.00317.88
8.2.60.0000.00818.30
8.2.50.0000.00818.07
8.2.40.0040.00418.47
8.2.30.0040.00418.29
8.2.20.0050.00218.02
8.2.10.0030.00518.06
8.2.00.0090.00017.91
8.1.270.0040.00422.27
8.1.260.0060.01226.35
8.1.250.0040.00428.09
8.1.240.0060.00321.22
8.1.230.0090.00817.55
8.1.220.0050.00317.91
8.1.210.0030.00518.77
8.1.200.0090.00017.35
8.1.190.0050.00317.64
8.1.180.0040.00418.10
8.1.170.0080.00018.50
8.1.160.0050.00322.37
8.1.150.0040.00418.83
8.1.140.0030.00617.68
8.1.130.0040.00418.01
8.1.120.0050.00217.66
8.1.110.0000.00717.57
8.1.100.0000.00817.69
8.1.90.0000.00717.56
8.1.80.0040.00417.57
8.1.70.0030.00317.68
8.1.60.0060.00317.81
8.1.50.0040.00417.57
8.1.40.0000.00917.81
8.1.30.0000.00817.82
8.1.20.0040.00417.77
8.1.10.0000.00817.84
8.1.00.0040.00417.71
8.0.300.0000.00918.77
8.0.290.0080.00016.73
8.0.280.0030.00318.63
8.0.270.0070.00017.41
8.0.260.0030.00316.88
8.0.250.0030.00317.02
8.0.240.0000.00717.10
8.0.230.0000.00717.07
8.0.220.0040.00417.04
8.0.210.0000.00817.19
8.0.200.0070.00017.09
8.0.190.0000.00817.12
8.0.180.0040.00417.11
8.0.170.0030.00516.98
8.0.160.0070.00017.04
8.0.150.0000.00716.91
8.0.140.0060.00317.07
8.0.130.0030.00313.50
8.0.120.0000.00817.00
8.0.110.0000.00817.07
8.0.100.0000.00817.06
8.0.90.0040.00417.16
8.0.80.0040.01217.05
8.0.70.0080.00017.23
8.0.60.0040.00417.04
8.0.50.0030.00517.04
8.0.30.0120.01017.40
8.0.20.0120.01217.40
8.0.10.0070.00017.05
8.0.00.0130.01316.96
7.4.330.0000.00515.23
7.4.320.0070.00016.79
7.4.300.0000.00616.77
7.4.290.0080.00516.82
7.4.280.0000.00716.71
7.4.270.0000.00716.76
7.4.260.0030.00616.82
7.4.250.0060.00316.69
7.4.240.0020.00516.68
7.4.230.0070.00016.84
7.4.220.0070.01116.64
7.4.210.0080.00816.84
7.4.200.0000.00716.57
7.4.190.0000.00716.63
7.4.160.0030.01316.65
7.4.150.0120.00617.40
7.4.140.0090.00917.86
7.4.130.0080.01016.63
7.4.120.0090.00916.78
7.4.110.0170.00016.51
7.4.100.0150.00316.86
7.4.90.0160.00316.65
7.4.80.0060.01219.39
7.4.70.0100.00716.54
7.4.60.0000.01616.60
7.4.50.0040.00416.60
7.4.40.0100.00622.77
7.4.30.0130.00316.73
7.4.10.0070.01314.95
7.4.00.0050.01214.90
7.3.330.0030.00313.52
7.3.320.0030.00313.32
7.3.310.0030.00316.55
7.3.300.0080.00016.59
7.3.290.0080.00716.56
7.3.280.0090.00516.55
7.3.270.0120.00817.40
7.3.260.0140.00516.57
7.3.250.0070.01216.63
7.3.240.0060.01016.71
7.3.230.0090.01216.53
7.3.210.0070.01116.83
7.3.200.0170.00619.39
7.3.190.0130.00616.63
7.3.180.0080.00816.93
7.3.170.0100.00616.77
7.3.160.0120.00316.71
7.3.130.0030.01615.20
7.3.120.0100.00714.88
7.3.110.0110.00715.20
7.3.100.0030.01014.89
7.3.90.0100.00714.86
7.3.80.0080.00415.01
7.3.70.0030.01214.97
7.3.60.0070.01014.80
7.3.50.0000.01215.11
7.3.40.0030.01214.90
7.3.30.0110.00314.96
7.3.20.0030.00716.84
7.3.10.0060.00816.57
7.3.00.0120.00516.47
7.2.330.0080.00817.01
7.2.320.0130.01016.99
7.2.310.0090.00916.90
7.2.300.0070.01016.92
7.2.290.0070.01717.01
7.2.260.0060.01315.18
7.2.250.0040.01415.12
7.2.240.0070.00715.13
7.2.230.0040.01115.32
7.2.220.0090.00915.08
7.2.210.0070.01015.41
7.2.200.0000.01915.17
7.2.190.0070.00315.17
7.2.180.0080.00415.20
7.2.170.0110.00415.47
7.2.160.0090.00915.14
7.2.150.0070.00717.15
7.2.140.0040.01117.02
7.2.130.0070.00816.90
7.2.120.0110.00516.80
7.2.110.0070.01016.92
7.2.100.0120.00516.88
7.2.90.0100.00716.90
7.2.80.0100.00817.10
7.2.70.0050.01216.84
7.2.60.0060.00916.94
7.2.50.0030.01016.86
7.2.40.0110.00416.72
7.2.30.0110.00916.96
7.2.20.0080.00916.85
7.2.10.0110.00716.70
7.2.00.0100.00616.96
7.1.330.0060.00615.89
7.1.320.0060.00916.09
7.1.310.0070.01015.91
7.1.300.0070.00316.16
7.1.290.0070.00415.98
7.1.280.0060.00915.75
7.1.270.0040.00815.72
7.1.260.0040.01115.91
7.1.250.0110.00515.71
7.1.240.0040.01415.81
7.1.230.0090.00615.93
7.1.220.0100.00315.90
7.1.210.0060.00615.95
7.1.200.0060.00615.98
7.1.190.0060.00915.97
7.1.180.0060.00616.08
7.1.170.0030.00916.20
7.1.160.0040.00815.92
7.1.150.0070.00715.67
7.1.140.0060.00916.08
7.1.130.0000.01515.96
7.1.120.0110.00415.94
7.1.110.0110.00715.80
7.1.100.0040.00416.04
7.1.90.0000.01616.13
7.1.80.0030.00616.06
7.1.70.0080.00516.63
7.1.60.0070.00717.90
7.1.50.0050.00916.57
7.1.40.0040.00815.75
7.1.30.0060.00315.96
7.1.20.0040.00716.04
7.1.10.0090.00615.95
7.1.00.0050.04019.17
7.0.330.0090.00315.66
7.0.320.0100.00715.38
7.0.310.0120.00315.55
7.0.300.0000.01315.47
7.0.290.0070.01015.49
7.0.280.0000.01315.50
7.0.270.0040.00715.48
7.0.260.0070.00715.64
7.0.250.0070.01015.71
7.0.240.0030.01015.49
7.0.230.0040.00715.68
7.0.220.0000.00915.38
7.0.210.0080.00015.55
7.0.200.2680.00516.14
7.0.190.0120.00415.45
7.0.180.0030.00915.53
7.0.170.0030.01015.48
7.0.160.0030.00515.65
7.0.150.0030.01015.51
7.0.140.0000.04418.79
7.0.130.0050.00315.58
7.0.120.0040.00715.71
7.0.110.0110.00415.47
7.0.100.0060.03317.68
7.0.90.0060.02417.80
7.0.80.0070.02617.66
7.0.70.0080.03517.66
7.0.60.0030.02317.75
7.0.50.0080.02317.98
7.0.40.0070.03616.79
7.0.30.0050.03317.05
7.0.20.0080.03516.81
7.0.10.0040.04716.83
7.0.00.0050.04816.88
5.6.400.0090.00614.43
5.6.390.0070.00714.36
5.6.380.0000.01214.41
5.6.370.0090.00014.37
5.6.360.0070.00414.19
5.6.350.0060.01414.47
5.6.340.0030.01014.41
5.6.330.0040.01114.58
5.6.320.0070.00314.75
5.6.310.0040.00814.16
5.6.300.0030.01014.60
5.6.290.0090.00614.36
5.6.280.0080.00414.70
5.6.270.0000.01414.76
5.6.260.0000.01414.47
5.6.250.0110.04017.69
5.6.240.0050.02417.69
5.6.230.0070.03717.64
5.6.220.0090.02417.73
5.6.210.0080.02717.67
5.6.200.0020.03417.81
5.6.190.0050.03417.85
5.6.180.0050.04517.95
5.6.170.0080.02317.94
5.6.160.0100.04317.85
5.6.150.0140.02317.74
5.6.140.0040.03417.72
5.6.130.0080.02217.85
5.6.120.0060.02317.65
5.6.110.0060.02817.74
5.6.100.0050.03217.76
5.6.90.0090.03217.88
5.6.80.0020.04517.31
5.6.70.0120.01717.49
5.6.60.0120.01517.44
5.6.50.0080.02017.38
5.6.40.0070.02217.37
5.6.30.0110.01817.27
5.6.20.0050.02317.37
5.6.10.0050.04317.54
5.6.00.0090.04317.45
5.5.380.0040.02417.43
5.5.370.0100.03517.49
5.5.360.0070.03817.49
5.5.350.0090.04217.49
5.5.340.0050.02817.69
5.5.330.0080.02517.75
5.5.320.0070.02617.78
5.5.310.0090.04717.68
5.5.300.0120.02517.77
5.5.290.0060.03417.71
5.5.280.0070.04117.72
5.5.270.0070.04017.62
5.5.260.0050.02517.60
5.5.250.0020.02817.62
5.5.240.0040.03817.45
5.5.230.0030.03317.34
5.5.220.0030.02517.41
5.5.210.0090.03717.26
5.5.200.0020.04617.30
5.5.190.0050.04417.31
5.5.180.0050.04217.41
5.5.170.0040.01214.30
5.5.160.0100.04017.43
5.5.150.0050.02017.30
5.5.140.0050.02117.43
5.5.130.0100.02217.29
5.5.120.0100.02017.48
5.5.110.0100.03217.53
5.5.100.0020.03917.46
5.5.90.0100.03517.24
5.5.80.0070.03717.34
5.5.70.0050.03317.45
5.5.60.0060.04117.32
5.5.50.0090.03717.36
5.5.40.0020.03817.42
5.5.30.0030.02817.22
5.5.20.0080.04317.40
5.5.10.0050.02817.36
5.5.00.0080.02717.16
5.4.450.0030.04015.57
5.4.440.0070.02815.33
5.4.430.0000.02515.62
5.4.420.0050.04015.40
5.4.410.0080.01715.35
5.4.400.0080.02015.11
5.4.390.0060.03315.25
5.4.380.0080.03815.16
5.4.370.0030.02215.16
5.4.360.0080.03515.20
5.4.350.0080.01715.40
5.4.340.0020.02715.21
5.4.330.0000.01111.25
5.4.320.0030.01715.20
5.4.310.0020.02115.27
5.4.300.0050.02115.14
5.4.290.0060.03315.32
5.4.280.0000.03915.11
5.4.270.0070.02815.35
5.4.260.0050.03515.13
5.4.250.0050.02015.26
5.4.240.0030.03215.14
5.4.230.0050.03915.31
5.4.220.0020.04415.15
5.4.210.0030.02715.11
5.4.200.0020.03815.20
5.4.190.0070.02415.24
5.4.180.0070.03815.18
5.4.170.0100.03515.28
5.4.160.0080.03315.27
5.4.150.0150.03915.16
5.4.140.0070.02014.00
5.4.130.0070.03513.94
5.4.120.0070.02313.99
5.4.110.0000.02713.87
5.4.100.0050.02313.81
5.4.90.0030.02313.88
5.4.80.0050.02213.95
5.4.70.0050.02313.89
5.4.60.0050.04014.00
5.4.50.0050.04014.03
5.4.40.0020.02513.93
5.4.30.0030.03213.80
5.4.20.0080.03713.98
5.4.10.0050.04114.02
5.4.00.0050.02513.64
5.3.290.0000.02512.72
5.3.280.0050.02412.72
5.3.270.0090.03212.66
5.3.260.0010.02912.75
5.3.250.0030.04412.68
5.3.240.0020.04312.67
5.3.230.0070.03712.73
5.3.220.0030.02612.60
5.3.210.0070.01912.59
5.3.200.0100.03212.63
5.3.190.0050.02212.70
5.3.180.0060.03012.65
5.3.170.0060.02412.72
5.3.160.0020.04012.64
5.3.150.0070.03512.59
5.3.140.0050.02012.54
5.3.130.0070.04012.69
5.3.120.0020.04512.70
5.3.110.0030.02512.61
5.3.100.0030.02112.42
5.3.90.0030.04012.53
5.3.80.0020.02612.48
5.3.70.0030.02912.35
5.3.60.0030.04312.29
5.3.50.0070.02212.42
5.3.40.0080.03812.53
5.3.30.0060.02812.32
5.3.20.0050.02112.35
5.3.10.0020.03712.16
5.3.00.0020.03212.15
5.2.170.0130.05011.62
5.2.160.0070.05311.62
5.2.150.0030.04711.62
5.2.140.0070.05311.62
5.2.130.0070.02711.62
5.2.120.0030.03711.62
5.2.110.0030.05011.62
5.2.100.0030.03311.62
5.2.90.0100.05311.62
5.2.80.0130.04311.62
5.2.70.0000.04011.62
5.2.60.0070.04311.62
5.2.50.0100.05311.62
5.2.40.0100.05311.62
5.2.30.0070.05311.62
5.2.20.0070.05311.62
5.2.10.0030.05311.62
5.2.00.0030.06011.62
5.1.60.0070.04011.62
5.1.50.0070.04711.62
5.1.40.0070.04711.62
5.1.30.0070.06011.62
5.1.20.0000.06311.62
5.1.10.0070.05311.62
5.1.00.0030.05311.62
5.0.50.0000.02311.62
5.0.40.0070.04011.62
5.0.30.0000.04011.62
5.0.20.0030.03311.62
5.0.10.0100.01711.62
5.0.00.0000.06711.62
4.4.90.0000.03011.62
4.4.80.0000.02311.62
4.4.70.0000.03011.62
4.4.60.0070.01311.62
4.4.50.0030.01711.62
4.4.40.0030.04311.62
4.4.30.0070.01311.62
4.4.20.0130.02711.62
4.4.10.0000.02011.62
4.4.00.0030.05011.62
4.3.110.0000.01711.62
4.3.100.0000.03011.62
4.3.90.0070.03311.62
4.3.80.0130.02011.62
4.3.70.0000.03011.62
4.3.60.0070.03311.62
4.3.50.0030.02711.62
4.3.40.0000.03311.62
4.3.30.0030.02011.62
4.3.20.0030.03011.62
4.3.10.0030.03311.62
4.3.00.0000.03011.62

preferences:
43.12 ms | 400 KiB | 5 Q