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 (is_int($offset)) { return new self($this->xml[$offset]->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']; var_dump((array)$xml['note']['recursive']['val']);

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.0070.01418.81
8.3.50.0120.00922.11
8.3.40.0040.01119.09
8.3.30.0110.00419.34
8.3.20.0040.00420.58
8.3.10.0030.00522.30
8.3.00.0060.00322.55
8.2.180.0060.01616.88
8.2.170.0090.00622.96
8.2.160.0070.00721.27
8.2.150.0090.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0060.00317.88
8.2.110.0030.00622.68
8.2.100.0080.00318.09
8.2.90.0060.00319.36
8.2.80.0070.00318.29
8.2.70.0000.01317.88
8.2.60.0040.00418.18
8.2.50.0040.00418.07
8.2.40.0030.00618.41
8.2.30.0000.00818.48
8.2.20.0040.00417.91
8.2.10.0040.00417.96
8.2.00.0050.00317.95
8.1.280.0170.00725.92
8.1.270.0030.00624.21
8.1.260.0080.00026.35
8.1.250.0110.00728.09
8.1.240.0050.00523.96
8.1.230.0110.00019.35
8.1.220.0040.00418.01
8.1.210.0050.00318.77
8.1.200.0000.00917.60
8.1.190.0060.00317.80
8.1.180.0100.00018.10
8.1.170.0060.00318.91
8.1.160.0050.00322.12
8.1.150.0030.00718.79
8.1.140.0050.00317.57
8.1.130.0000.00818.18
8.1.120.0000.00717.66
8.1.110.0000.00717.78
8.1.100.0070.00017.70
8.1.90.0040.00417.70
8.1.80.0000.00717.73
8.1.70.0070.00017.66
8.1.60.0030.00517.94
8.1.50.0030.00517.83
8.1.40.0070.00317.82
8.1.30.0040.00417.86
8.1.20.0050.00317.88
8.1.10.0050.00317.81
8.1.00.0030.00517.79
8.0.300.0000.00818.77
8.0.290.0070.00017.55
8.0.280.0000.00718.76
8.0.270.0000.00717.55
8.0.260.0000.00717.12
8.0.250.0030.00317.13
8.0.240.0050.00317.21
8.0.230.0070.00017.25
8.0.220.0000.00817.09
8.0.210.0040.00417.08
8.0.200.0050.00317.20
8.0.190.0040.00417.25
8.0.180.0030.00517.14
8.0.170.0080.00017.12
8.0.160.0000.00717.09
8.0.150.0040.00417.11
8.0.140.0040.00417.11
8.0.130.0030.00313.57
8.0.120.0000.00717.09
8.0.110.0020.00517.11
8.0.100.0040.00417.06
8.0.90.0000.00817.18
8.0.80.0030.01217.21
8.0.70.0030.00516.96
8.0.60.0020.00517.21
8.0.50.0050.00216.98
8.0.30.0050.01317.46
8.0.20.0150.00717.64
8.0.10.0000.00717.13
8.0.00.0100.00916.94
7.4.330.0000.00515.27
7.4.320.0000.00716.89
7.4.300.0070.00016.89
7.4.290.0030.00316.75
7.4.280.0000.00716.89
7.4.270.0040.00416.80
7.4.260.0000.00716.93
7.4.250.0000.00716.79
7.4.240.0020.00516.82
7.4.230.0050.00316.92
7.4.220.0070.01116.81
7.4.210.0070.00716.88
7.4.200.0000.00716.91
7.4.190.0000.00716.99
7.4.160.0120.00416.86
7.4.150.0140.00417.40
7.4.140.0130.00917.86
7.4.130.0090.00816.76
7.4.120.0110.00616.79
7.4.110.0120.00616.71
7.4.100.0150.00316.71
7.4.90.0110.00716.59
7.4.80.0130.00316.76
7.4.70.0110.00616.89
7.4.60.0070.01016.69
7.4.50.0020.00216.73
7.4.40.0070.00722.77
7.4.30.0110.00617.05
7.4.00.0080.01315.20
7.3.330.0000.00613.63
7.3.320.0000.00513.62
7.3.310.0030.00316.49
7.3.300.0000.00716.66
7.3.290.0080.00616.66
7.3.280.0100.00816.63
7.3.270.0090.00917.40
7.3.260.0090.01516.65
7.3.250.0030.01516.70
7.3.240.0110.00716.82
7.3.230.0170.00016.74
7.3.210.0120.00616.70
7.3.200.0140.00319.39
7.3.190.0110.01016.97
7.3.180.0100.00716.87
7.3.170.0100.01316.54
7.3.160.0110.01116.82
7.3.120.0110.00815.06
7.3.110.0070.01214.94
7.3.100.0180.00414.81
7.3.90.0100.01214.95
7.3.80.0080.01315.15
7.3.70.0120.00915.09
7.3.60.0100.00814.98
7.3.50.0110.01314.90
7.3.40.0100.01215.04
7.3.30.0140.00914.91
7.3.20.0080.01316.79
7.3.10.0060.01316.87
7.3.00.0120.00516.66
7.2.330.0090.00917.06
7.2.320.0120.00617.03
7.2.310.0150.00916.79
7.2.300.0030.01517.04
7.2.290.0090.00916.85
7.2.250.0120.01115.38
7.2.240.0130.00915.19
7.2.230.0090.01215.45
7.2.220.0150.00515.27
7.2.210.0060.01615.22
7.2.200.0100.01115.19
7.2.190.0080.01015.34
7.2.180.0120.00915.20
7.2.170.0140.00915.21
7.2.160.0190.01115.17
7.2.150.0080.02017.01
7.2.140.0120.01416.83
7.2.130.0100.00717.18
7.2.120.0120.01017.02
7.2.110.0140.00617.09
7.2.100.0110.01117.14
7.2.90.0110.01116.96
7.2.80.0070.01317.05
7.2.70.0050.01717.10
7.2.60.0130.00717.08
7.2.50.0060.01316.89
7.2.40.0040.01216.99
7.2.30.0090.00517.31
7.2.20.0050.01017.05
7.2.10.0060.00717.04
7.2.00.0100.00517.05
7.1.330.0110.00915.77
7.1.320.0090.00716.04
7.1.310.0140.00615.90
7.1.300.0090.01015.75
7.1.290.0150.00815.95
7.1.280.0160.00615.91
7.1.270.0110.01015.83
7.1.260.0090.00716.07
7.1.250.0080.01315.94
7.1.240.0030.01116.01
7.1.230.0080.00615.63
7.1.220.0030.01215.80
7.1.210.0090.00315.89
7.1.200.0050.01015.92
7.1.190.0120.00815.66
7.1.180.0170.00615.96
7.1.170.0190.00515.91
7.1.160.0030.01116.08
7.1.150.0100.00015.79
7.1.140.0110.00616.04
7.1.130.0110.00415.72
7.1.120.0120.00416.09
7.1.110.0040.00815.87
7.1.100.0030.01015.94
7.1.90.0060.00915.79
7.1.80.0080.00816.00
7.1.70.0030.00816.50
7.1.60.0110.00617.96
7.1.50.0090.00716.46
7.1.40.0030.01215.80
7.1.30.0000.01415.86
7.1.20.0040.00815.84
7.1.10.0000.01015.89
7.1.00.0050.04019.22
7.0.330.0080.01615.70
7.0.320.0060.00615.34
7.0.310.0040.00915.14
7.0.300.0110.01115.57
7.0.290.0080.00815.74
7.0.280.0040.00915.38
7.0.270.0000.01715.66
7.0.260.0000.01115.54
7.0.250.0070.00315.64
7.0.240.0040.00715.70
7.0.230.0070.00715.56
7.0.220.0070.00715.76
7.0.210.0040.00715.68
7.0.200.0120.00116.27
7.0.190.0030.01015.59
7.0.180.0090.00615.62
7.0.170.0080.00815.65
7.0.160.0030.01415.55
7.0.150.0030.00915.50
7.0.140.0030.03918.93
7.0.130.0060.00315.40
7.0.120.0060.00615.55
7.0.110.0030.01015.55
7.0.100.0050.03717.92
7.0.90.0120.02817.79
7.0.80.0070.03417.84
7.0.70.0070.03717.75
7.0.60.0080.04317.77
7.0.50.0040.03118.01
7.0.40.0090.04416.87
7.0.30.0050.04016.83
7.0.20.0100.04116.86
7.0.10.0050.04816.94
7.0.00.0130.04016.87
5.6.400.0140.01414.68
5.6.390.0180.01314.33
5.6.380.0060.00914.39
5.6.370.0040.00714.13
5.6.360.0190.00514.64
5.6.350.0000.01014.65
5.6.340.0000.01414.88
5.6.330.0000.01114.54
5.6.320.0030.01314.56
5.6.310.0030.01314.68
5.6.300.0070.01014.77
5.6.290.0080.00414.52
5.6.280.0060.00314.64
5.6.270.0100.00314.54
5.6.260.0060.00914.60
5.6.250.0080.04017.58
5.6.240.0070.05017.68
5.6.230.0050.04817.73
5.6.220.0050.04317.70
5.6.210.0090.03717.57
5.6.200.0080.04217.83
5.6.190.0050.03417.89
5.6.180.0140.03817.81
5.6.170.0080.02717.95
5.6.160.0080.04417.89
5.6.150.0090.02618.02
5.6.140.0050.03917.71
5.6.130.0020.04917.66
5.6.120.0110.03318.01
5.6.110.0070.04417.78
5.6.100.0070.04317.90
5.6.90.0070.04517.80
5.6.80.0040.03917.61
5.6.70.0060.03017.51
5.6.60.0100.03817.51
5.6.50.0070.04317.54
5.6.40.0030.05117.65
5.6.30.0120.03717.67
5.6.20.0100.04117.45
5.6.10.0050.03117.50
5.6.00.0070.03217.54
5.5.380.0160.04217.39
5.5.370.0160.04317.63
5.5.360.0160.04317.52
5.5.350.0130.04517.65
5.5.340.0160.03617.61
5.5.330.0080.03317.81
5.5.320.0180.03617.65
5.5.310.0120.03117.68
5.5.300.0080.04017.80
5.5.290.0170.04017.73
5.5.280.0110.04517.72
5.5.270.0120.04517.71
5.5.260.0070.05417.73
5.5.250.0120.04217.58
5.5.240.0150.04017.41
5.5.230.0170.03317.37
5.5.220.0070.03517.49
5.5.210.0100.02617.45
5.5.200.0130.04317.39
5.5.190.0140.04317.50
5.5.180.0120.04617.29
5.5.170.0090.01514.75
5.5.160.0140.04317.36
5.5.150.0080.03317.31
5.5.140.0070.03117.37
5.5.130.0140.04117.35
5.5.120.0080.04217.47
5.5.110.0090.03917.31
5.5.100.0110.03917.31
5.5.90.0060.03917.37
5.5.80.0090.04417.20
5.5.70.0100.04417.25
5.5.60.0150.03617.25
5.5.50.0130.04317.20
5.5.40.0050.03617.38
5.5.30.0140.04317.27
5.5.20.0090.04517.34
5.5.10.0090.04017.42
5.5.00.0060.03217.40
5.4.450.0080.04215.27
5.4.440.0090.02615.26
5.4.430.0100.04115.43
5.4.420.0120.03615.48
5.4.410.0110.03915.38
5.4.400.0040.04715.17
5.4.390.0060.04315.20
5.4.380.0160.03515.23
5.4.370.0050.04615.23
5.4.360.0090.04015.03
5.4.350.0110.02315.24
5.4.340.0110.03615.15
5.4.330.0130.00611.42
5.4.320.0070.04515.29
5.4.310.0070.04315.20
5.4.300.0120.02915.14
5.4.290.0090.02515.21
5.4.280.0120.02315.31
5.4.270.0100.03615.27
5.4.260.0050.03115.25
5.4.250.0110.03815.26
5.4.240.0140.03615.18
5.4.230.0120.02115.36
5.4.220.0160.03215.08
5.4.210.0030.04515.05
5.4.200.0110.03315.06
5.4.190.0100.03215.09
5.4.180.0090.03715.24
5.4.170.0080.04315.07
5.4.160.0100.04015.27
5.4.150.0060.04415.25
5.4.140.0090.04113.76
5.4.130.0130.03413.85
5.4.120.0020.04113.86
5.4.110.0130.03513.83
5.4.100.0090.03513.99
5.4.90.0050.02813.97
5.4.80.0090.03313.89
5.4.70.0070.02813.85
5.4.60.0100.03713.80
5.4.50.0080.04013.86
5.4.40.0110.03313.85
5.4.30.0080.03613.87
5.4.20.0060.04113.98
5.4.10.0040.04313.89
5.4.00.0090.02013.40
5.3.290.0090.04012.86
5.3.280.0100.03912.77
5.3.270.0110.03912.69
5.3.260.0110.04712.71
5.3.250.0090.04012.66
5.3.240.0070.02212.63
5.3.230.0090.02512.72
5.3.220.0090.03512.58
5.3.210.0110.03712.72
5.3.200.0080.03312.64
5.3.190.0080.04012.67
5.3.180.0070.03712.73
5.3.170.0020.03512.67
5.3.160.0040.03112.68
5.3.150.0090.02812.73
5.3.140.0080.04512.78
5.3.130.0110.03712.64
5.3.120.0070.04212.61
5.3.110.0050.04512.68
5.3.100.0060.02212.35
5.3.90.0070.02412.40
5.3.80.0090.02412.38
5.3.70.0050.02712.46
5.3.60.0120.03512.32
5.3.50.0080.02112.39
5.3.40.0060.03512.38
5.3.30.0050.02412.45
5.3.20.0090.03612.21
5.3.10.0070.04312.17
5.3.00.0060.03312.10
5.2.170.0030.06311.13
5.2.160.0100.05711.14
5.2.150.0030.04311.29
5.2.140.0100.03011.32
5.2.130.0030.05711.20
5.2.120.0030.03711.20
5.2.110.0070.04311.30
5.2.100.0030.06311.34
5.2.90.0000.03711.26
5.2.80.0100.03011.26
5.2.70.0130.05711.27
5.2.60.0000.03311.21
5.2.50.0030.02711.19
5.2.40.0100.05311.16
5.2.30.0070.02311.21
5.2.20.0100.05711.13
5.2.10.0070.03711.11
5.2.00.0100.05710.91
5.1.60.0030.02310.80
5.1.50.0130.02010.80
5.1.40.0000.05010.80
5.1.30.0030.05010.80
5.1.20.0000.03710.80
5.1.10.0000.04310.80
5.1.00.0030.05310.80
5.0.50.0000.02710.80
5.0.40.0000.03710.80
5.0.30.0030.06010.80
5.0.20.0100.02010.80
5.0.10.0070.04010.80
5.0.00.0100.05710.80
4.4.90.0000.04010.80
4.4.80.0000.01710.80
4.4.70.0070.03310.80
4.4.60.0070.02310.80
4.4.50.0070.03010.80
4.4.40.0000.05310.80
4.4.30.0070.03010.80
4.4.20.0000.04010.80
4.4.10.0070.02710.80
4.4.00.0000.05310.80
4.3.110.0000.02010.80
4.3.100.0000.03710.80
4.3.90.0030.03010.80
4.3.80.0030.04710.80
4.3.70.0070.03010.80
4.3.60.0030.01710.80
4.3.50.0130.02710.80
4.3.40.0030.04010.80
4.3.30.0030.03310.80
4.3.20.0000.03010.80
4.3.10.0000.02010.80
4.3.00.0070.03010.80

preferences:
43.12 ms | 401 KiB | 5 Q