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); } var_dump($this->xml); 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']; echo $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.70.0100.01316.88
8.3.60.0120.00316.75
8.3.50.0100.00822.13
8.3.40.0060.00919.20
8.3.30.0090.00619.52
8.3.20.0050.00320.41
8.3.10.0060.00323.95
8.3.00.0040.00419.75
8.2.180.0090.00618.81
8.2.170.0060.01222.96
8.2.160.0090.00620.57
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00522.62
8.2.110.0030.00719.50
8.2.100.0080.00418.28
8.2.90.0030.00518.47
8.2.80.0000.00820.83
8.2.70.0060.00317.75
8.2.60.0050.00318.30
8.2.50.0110.00018.07
8.2.40.0040.00420.43
8.2.30.0030.00518.52
8.2.20.0000.00818.11
8.2.10.0080.00018.34
8.2.00.0070.00017.96
8.1.280.0080.00825.92
8.1.270.0080.00024.09
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0070.00324.07
8.1.230.0100.00521.16
8.1.220.0000.00918.02
8.1.210.0000.00819.21
8.1.200.0060.00317.63
8.1.190.0050.00317.61
8.1.180.0030.00518.10
8.1.170.0060.00318.93
8.1.160.0030.00622.28
8.1.150.0040.00418.92
8.1.140.0000.00717.75
8.1.130.0000.00718.11
8.1.120.0030.00417.63
8.1.110.0030.00517.72
8.1.100.0080.00017.76
8.1.90.0000.00717.72
8.1.80.0080.00017.70
8.1.70.0030.00317.72
8.1.60.0060.00617.89
8.1.50.0060.00317.75
8.1.40.0000.00817.84
8.1.30.0040.00417.82
8.1.20.0000.00717.87
8.1.10.0050.00217.82
8.1.00.0030.00617.76
8.0.300.0070.00320.24
8.0.290.0000.00817.40
8.0.280.0030.00318.64
8.0.270.0000.00717.08
8.0.260.0000.00717.52
8.0.250.0040.00417.27
8.0.240.0030.00317.20
8.0.230.0050.00217.25
8.0.220.0000.00717.07
8.0.210.0030.00617.21
8.0.200.0070.00017.25
8.0.190.0000.00817.12
8.0.180.0090.00017.09
8.0.170.0000.00817.09
8.0.160.0040.00417.22
8.0.150.0020.00517.06
8.0.140.0050.00317.19
8.0.130.0060.00013.57
8.0.120.0060.00317.16
8.0.110.0040.00417.14
8.0.100.0050.00317.03
8.0.90.0040.00417.24
8.0.80.0070.01017.21
8.0.70.0050.00217.01
8.0.60.0060.00317.21
8.0.50.0040.00416.97
8.0.30.0100.00917.39
8.0.20.0140.00617.41
8.0.10.0040.00417.09
8.0.00.0090.01216.96
7.4.330.0030.00315.35
7.4.320.0030.00316.64
7.4.300.0060.00716.91
7.4.290.0030.00316.77
7.4.280.0000.00816.69
7.4.270.0000.00816.82
7.4.260.0000.00816.89
7.4.250.0070.00016.71
7.4.240.0060.00216.85
7.4.230.0000.00716.92
7.4.220.0070.01316.72
7.4.210.0100.00516.75
7.4.200.0030.00516.57
7.4.190.0040.00416.67
7.4.160.0140.00316.97
7.4.150.0140.00617.40
7.4.140.0050.01217.86
7.4.130.0120.00516.84
7.4.120.0130.01016.74
7.4.110.0030.01316.75
7.4.100.0070.01416.83
7.4.90.0110.00816.81
7.4.80.0110.01019.39
7.4.70.0070.01016.87
7.4.60.0130.00616.60
7.4.50.0030.00616.55
7.4.40.0090.00916.90
7.4.30.0030.01416.64
7.4.00.0030.01014.94
7.3.330.0000.00513.64
7.3.320.0000.00613.44
7.3.310.0000.00716.59
7.3.300.0040.00416.56
7.3.290.0070.01116.65
7.3.280.0120.00616.65
7.3.270.0060.01217.40
7.3.260.0190.00016.70
7.3.250.0100.00816.73
7.3.240.0090.00916.90
7.3.230.0030.01416.84
7.3.210.0040.01516.70
7.3.200.0150.01219.39
7.3.190.0100.01016.69
7.3.180.0200.00316.71
7.3.170.0140.00516.82
7.3.160.0110.00816.89
7.3.120.0040.01115.17
7.3.00.0060.00616.92
7.2.330.0120.00916.79
7.2.320.0120.00616.70
7.2.310.0130.00517.13
7.2.300.0070.00917.05
7.2.290.0100.01016.78
7.2.130.0000.00917.04
7.2.120.0060.00917.09
7.2.110.0030.01016.93
7.2.100.0030.00916.99
7.2.90.0030.01017.20
7.2.80.0100.00317.04
7.2.70.0100.00317.30
7.2.60.0030.01017.07
7.2.50.0030.00916.96
7.2.40.0000.01217.11
7.2.30.0040.00817.19
7.2.20.0100.00317.00
7.2.10.0150.00317.11
7.2.00.0060.00618.42
7.1.250.0070.00015.97
7.1.240.0000.01116.00
7.1.230.0110.00315.89
7.1.220.0030.01015.75
7.1.210.0100.00315.84
7.1.200.0060.00615.82
7.1.190.0110.00415.87
7.1.180.0060.00716.21
7.1.170.0100.00315.84
7.1.160.0060.00615.72
7.1.150.0070.00715.71
7.1.140.0060.00615.90
7.1.130.0090.00016.07
7.1.120.0030.00615.94
7.1.110.0000.00916.08
7.1.100.0060.00817.14
7.1.90.0000.00815.96
7.1.80.0000.01416.05
7.1.70.0050.00616.65
7.1.60.0110.00517.74
7.1.50.0090.00816.45
7.1.40.0030.00916.11
7.1.30.0060.00616.00
7.1.20.0030.00715.84
7.1.10.0000.01215.88
7.1.00.0080.03719.22
7.0.330.0040.00715.34
7.0.320.0040.00815.41
7.0.310.0160.00015.56
7.0.300.0070.00715.70
7.0.290.0040.00715.47
7.0.280.0080.00315.67
7.0.270.0000.01315.59
7.0.260.0000.01415.47
7.0.250.0030.01015.53
7.0.240.0000.00715.75
7.0.230.0070.00315.63
7.0.220.0060.00915.68
7.0.210.0110.00515.71
7.0.200.0050.00516.16
7.0.190.0030.00615.43
7.0.180.0030.00815.46
7.0.170.0030.01115.50
7.0.160.0090.00915.72
7.0.150.0040.00815.54
7.0.140.0020.04018.91
7.0.130.0060.00615.57
7.0.120.0050.00515.57
7.0.110.0070.00315.58
7.0.100.0030.00615.70
7.0.90.0060.00615.50
7.0.80.0030.00915.51
7.0.70.0030.02218.70
7.0.60.0020.03018.73
7.0.50.0050.04118.99
7.0.40.0070.04016.91
7.0.30.0100.04016.86
7.0.20.0060.04316.84
7.0.10.0060.04316.92
7.0.00.0040.04416.92
5.6.380.0000.01414.58
5.6.370.0000.00914.52
5.6.360.0030.01014.69
5.6.350.0030.01414.47
5.6.340.0000.01414.66
5.6.330.0030.01314.57
5.6.320.0040.00414.73
5.6.310.0060.00614.92
5.6.300.0030.01014.33
5.6.290.0040.00714.67
5.6.280.0060.03617.85
5.6.270.0060.00614.63
5.6.260.0040.00414.83
5.6.250.0040.00714.38
5.6.240.0030.00714.61
5.6.230.0040.00714.76
5.6.220.0100.02717.49
5.6.210.0050.02617.58
5.6.200.0070.04217.95
5.6.190.0070.03217.95
5.6.180.0040.04517.99
5.6.170.0040.04717.98
5.6.160.0060.03817.87
5.6.150.0060.02317.81
5.6.140.0060.03417.81
5.6.130.0050.03917.91
5.6.120.0080.04517.80
5.6.110.0070.04217.86
5.6.100.0050.05017.86
5.6.90.0020.04717.70
5.6.80.0120.03517.35
5.6.70.0000.04617.56
5.6.60.0060.02117.61
5.6.50.0000.02917.70
5.6.40.0030.03417.36
5.6.30.0070.03717.35
5.6.20.0020.04617.51
5.6.10.0030.04417.49
5.6.00.0070.04017.34
5.5.380.0000.00611.30
5.5.370.0080.00311.19
5.5.360.0030.02115.97
5.5.350.0000.02915.97
5.5.340.0100.03216.08
5.5.330.0070.04216.24
5.5.320.0060.04116.22
5.5.310.0020.04116.12
5.5.300.0050.03516.24
5.5.290.0060.03816.20
5.5.280.0030.04016.16
5.5.270.0000.04716.21
5.5.260.0030.04216.23
5.5.250.0030.04816.09
5.5.240.0070.02015.76
5.5.230.0050.04115.73
5.5.220.0050.04015.81
5.5.210.0020.04515.76
5.5.200.0030.04315.91
5.5.190.0030.04215.72
5.5.180.0060.04015.84
5.5.170.0060.00011.32
5.5.160.0060.03815.80
5.5.150.0020.04315.89
5.5.140.0070.03015.83
5.5.130.0030.04015.78
5.5.120.0000.04315.92
5.5.110.0020.04715.76
5.5.100.0040.03915.75
5.5.90.0020.04015.79
5.5.80.0070.04015.63
5.5.70.0080.03515.63
5.5.60.0090.04015.80
5.5.50.0070.03715.68
5.5.40.0020.04215.78
5.5.30.0030.04115.82
5.5.20.0050.04015.74
5.5.10.0030.04615.76
5.5.00.0040.04115.67
5.4.450.0050.03815.51
5.4.440.0050.04215.35
5.4.430.0050.04015.49
5.4.420.0060.04115.46
5.4.410.0030.03715.22
5.4.400.0050.04015.17
5.4.390.0050.04215.27
5.4.380.0080.03615.12
5.4.370.0050.04015.19
5.4.360.0060.03815.26
5.4.350.0050.03815.18
5.4.340.0030.04215.13
5.4.330.0030.00611.16
5.4.320.0070.04115.14
5.4.310.0050.03715.11
5.4.300.0080.02815.21
5.4.290.0060.03514.98
5.4.280.0080.04115.27
5.4.270.0080.03715.32
5.4.260.0050.03715.08
5.4.250.0030.04115.22
5.4.240.0070.03015.15
5.4.230.0040.04215.23
5.4.220.0080.02815.28
5.4.210.0040.03815.29
5.4.200.0050.03315.27
5.4.190.0040.04215.26
5.4.180.0060.03815.20
5.4.170.0000.04215.15
5.4.160.0050.03015.19
5.4.150.0060.03815.19
5.4.140.0050.03613.80
5.4.130.0110.03713.88
5.4.120.0030.03613.84
5.4.110.0030.04113.85
5.4.100.0030.03713.86
5.4.90.0020.04013.94
5.4.80.0040.03813.91
5.4.70.0000.04113.83
5.4.60.0020.03613.93
5.4.50.0060.03013.96
5.4.40.0050.03913.98
5.4.30.0030.03814.04
5.4.20.0080.03513.89
5.4.10.0020.04313.97
5.4.00.0020.03813.70
5.3.290.0040.03712.85
5.3.280.0050.03312.73
5.3.270.0030.03912.74
5.3.260.0000.04312.68
5.3.250.0070.03212.74
5.3.240.0060.03512.79
5.3.230.0000.04412.76
5.3.220.0000.04312.68
5.3.210.0060.03712.68
5.3.200.0050.03912.69
5.3.190.0020.04112.80
5.3.180.0030.04012.76
5.3.170.0030.04112.79
5.3.160.0050.03912.69
5.3.150.0010.04312.78
5.3.140.0040.03912.64
5.3.130.0030.03812.80
5.3.120.0080.03612.69
5.3.110.0060.02812.59
5.3.100.0020.04112.44
5.3.90.0050.03812.60
5.3.80.0040.03712.38
5.3.70.0050.03812.41
5.3.60.0110.02712.46
5.3.50.0050.03412.41
5.3.40.0020.03612.51
5.3.30.0050.03812.39
5.3.20.0050.03012.33
5.3.10.0060.03512.21
5.3.00.0070.03211.97
5.2.170.0040.03210.54
5.2.160.0000.03310.48
5.2.150.0040.03310.55
5.2.140.0030.02510.58
5.2.130.0030.03010.47
5.2.120.0020.03010.54
5.2.110.0020.03410.53
5.2.100.0030.02110.48
5.2.90.0020.02210.43
5.2.80.0030.02010.42
5.2.70.0020.01810.41
5.2.60.0060.01310.36
5.2.50.0070.01310.45
5.2.40.0030.01810.42
5.2.30.0050.01310.40
5.2.20.0050.01510.35
5.2.10.0020.01710.33
5.2.00.0000.02010.33
5.1.60.0050.01210.33
5.1.50.0000.01310.33
5.1.40.0020.01410.33
5.1.30.0030.01110.33
5.1.20.0010.01610.33
5.1.10.0030.01010.33
5.1.00.0020.01210.33
5.0.50.0000.01010.33
5.0.40.0060.00710.33
5.0.30.0020.01510.33
5.0.20.0020.00910.33
5.0.10.0030.00810.33
5.0.00.0020.02010.33
4.4.90.0020.00710.33
4.4.80.0020.00810.33
4.4.70.0020.00910.33
4.4.60.0000.00810.33
4.4.50.0020.00710.33
4.4.40.0000.01210.33
4.4.30.0010.00810.33
4.4.20.0000.01010.33
4.4.10.0020.00710.33
4.4.00.0000.01210.33
4.3.110.0030.00810.33
4.3.100.0030.01510.33
4.3.90.0020.00710.33
4.3.80.0000.01210.33
4.3.70.0020.00810.33
4.3.60.0040.00810.33
4.3.50.0000.00910.33
4.3.40.0000.01410.33
4.3.30.0010.00710.33
4.3.20.0030.00610.33
4.3.10.0030.00510.33
4.3.00.0030.00710.33

preferences:
37.16 ms | 401 KiB | 5 Q