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 (preg_match('/(\w+)(\[\d+\])/', $offset, $nodes)) { var_dump($nodes); 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']; $xml['note']['recursive']['val[1]'];

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.0160.00317.13
8.3.50.0150.00522.37
8.3.40.0100.01019.29
8.3.30.0140.00719.29
8.3.20.0000.00820.50
8.3.10.0060.00323.89
8.3.00.0130.00319.88
8.2.180.0110.01118.72
8.2.170.0100.01022.96
8.2.160.0080.01220.50
8.2.150.0070.01424.18
8.2.140.0110.00824.66
8.2.130.0110.00726.16
8.2.120.0000.00822.38
8.2.110.0040.00422.50
8.2.100.0060.00618.28
8.2.90.0000.00819.61
8.2.80.0000.00818.05
8.2.70.0080.00018.13
8.2.60.0040.00418.18
8.2.50.0000.00818.07
8.2.40.0000.00818.47
8.2.30.0040.00418.44
8.2.20.0060.00318.21
8.2.10.0070.00318.55
8.2.00.0050.00518.16
8.1.280.0140.00725.92
8.1.270.0040.01524.40
8.1.260.0050.00326.35
8.1.250.0110.00728.09
8.1.240.0060.00324.04
8.1.230.0000.01219.47
8.1.220.0030.00618.04
8.1.210.0060.00318.77
8.1.200.0090.00017.86
8.1.190.0050.00318.01
8.1.180.0060.00318.10
8.1.170.0060.00319.16
8.1.160.0000.00822.20
8.1.150.0050.00319.06
8.1.140.0040.00417.84
8.1.130.0000.00718.22
8.1.120.0000.00717.86
8.1.110.0000.00817.90
8.1.100.0000.00717.90
8.1.90.0060.00317.79
8.1.80.0050.00217.83
8.1.70.0030.00317.75
8.1.60.0040.00417.96
8.1.50.0000.00817.96
8.1.40.0000.00817.99
8.1.30.0000.00818.02
8.1.20.0000.00918.11
8.1.10.0000.00918.02
8.1.00.0000.00817.98
8.0.300.0000.00718.77
8.0.290.0030.00617.43
8.0.280.0030.00318.75
8.0.270.0040.00417.54
8.0.260.0040.00419.02
8.0.250.0040.00417.34
8.0.240.0080.00017.49
8.0.230.0030.00417.34
8.0.220.0030.00317.26
8.0.210.0000.00717.26
8.0.200.0000.00717.39
8.0.190.0000.00817.50
8.0.180.0040.00417.36
8.0.170.0040.00417.33
8.0.160.0000.00717.39
8.0.150.0040.00417.29
8.0.140.0040.00417.35
8.0.130.0000.00713.79
8.0.120.0000.00817.32
8.0.110.0000.00717.27
8.0.100.0030.00617.34
8.0.90.0000.00817.38
8.0.80.0070.00817.28
8.0.70.0080.00017.39
8.0.60.0050.00517.42
8.0.50.0070.00017.44
8.0.30.0100.00917.36
8.0.20.0110.01217.65
8.0.10.0060.00317.46
8.0.00.0070.01217.12
7.4.330.0030.00315.47
7.4.320.0000.00616.94
7.4.300.0000.00717.13
7.4.290.0030.00316.97
7.4.280.0030.00317.04
7.4.270.0040.00417.06
7.4.260.0000.00917.02
7.4.250.0000.00816.99
7.4.240.0030.00516.91
7.4.230.0040.00417.07
7.4.220.0130.01017.11
7.4.210.0080.00817.03
7.4.200.0070.00016.72
7.4.190.0030.00317.25
7.4.160.0130.00317.07
7.4.150.0150.01217.40
7.4.140.0090.00917.86
7.4.130.0120.00617.03
7.4.120.0120.00716.99
7.4.110.0030.01517.03
7.4.100.0120.00616.85
7.4.90.0100.00916.93
7.4.80.0040.01619.39
7.4.70.0110.01116.96
7.4.60.0070.01016.88
7.4.50.0040.00416.92
7.4.40.0090.00622.77
7.4.30.0090.00916.98
7.4.10.0100.01015.26
7.4.00.0040.01315.36
7.3.330.0000.00513.71
7.3.320.0060.00013.84
7.3.310.0040.00416.88
7.3.300.0030.00316.80
7.3.290.0070.01416.84
7.3.280.0090.00816.83
7.3.270.0100.00717.40
7.3.260.0060.01517.13
7.3.250.0090.00916.91
7.3.240.0070.01017.02
7.3.230.0090.00916.80
7.3.210.0090.00816.98
7.3.200.0060.01619.39
7.3.190.0200.00316.82
7.3.180.0170.00016.83
7.3.170.0040.01316.96
7.3.160.0050.01116.78
7.3.130.0110.00615.45
7.3.120.0070.01015.34
7.3.110.0050.00915.16
7.3.100.0040.01315.19
7.3.90.0070.00815.12
7.3.80.0030.01015.37
7.3.70.0060.00715.18
7.3.60.0020.00915.20
7.3.50.0030.01015.16
7.3.40.0070.00515.03
7.3.30.0080.00315.27
7.3.20.0060.01316.98
7.3.10.0020.01517.03
7.3.00.0080.00916.78
7.2.330.0130.00917.04
7.2.320.0110.00817.18
7.2.310.0090.00917.21
7.2.300.0100.01317.05
7.2.290.0060.01217.30
7.2.260.0100.01015.09
7.2.250.0060.01315.35
7.2.240.0080.00815.52
7.2.230.0050.01115.43
7.2.220.0050.01115.31
7.2.210.0060.00515.33
7.2.200.0050.01015.39
7.2.190.0050.00715.27
7.2.180.0060.00815.26
7.2.170.0130.00015.27
7.2.160.0100.00715.43
7.2.150.0070.01117.17
7.2.140.0100.00817.23
7.2.130.0060.00916.92
7.2.120.0060.00717.24
7.2.110.0070.01117.26
7.2.100.0060.00817.28
7.2.90.0080.00617.34
7.2.80.0050.01017.39
7.2.70.0110.00517.21
7.2.60.0070.00917.18
7.2.50.0060.01217.27
7.2.40.0080.01017.27
7.2.30.0110.00817.18
7.2.20.0090.00717.00
7.2.10.0110.00717.30
7.2.00.0060.00717.94
7.1.330.0070.00716.00
7.1.320.0000.01316.16
7.1.310.0020.01116.07
7.1.300.0020.01116.23
7.1.290.0070.00516.17
7.1.280.0080.00715.95
7.1.270.0060.00916.17
7.1.260.0040.01016.08
7.1.250.0060.00616.01
7.1.240.0080.01015.91
7.1.230.0080.00915.91
7.1.220.0070.00416.09
7.1.210.0080.00716.28
7.1.200.0070.00616.07
7.1.190.0070.00716.09
7.1.180.0030.00716.01
7.1.170.0060.00916.02
7.1.160.0100.00416.02
7.1.150.0090.00816.02
7.1.140.0110.00616.09
7.1.130.0110.00715.93
7.1.120.0090.00616.18
7.1.110.0080.00616.12
7.1.100.0040.01116.90
7.1.90.0070.00916.22
7.1.80.0080.00616.13
7.1.70.0060.00616.65
7.1.60.0070.01117.12
7.1.50.0040.01016.50
7.1.40.0060.00615.95
7.1.30.0050.00516.00
7.1.20.0020.01016.14
7.1.10.0130.00316.09
7.1.00.0100.02818.21
7.0.330.0100.00315.58
7.0.320.0030.01115.43
7.0.310.0060.00815.67
7.0.300.0060.01015.54
7.0.290.0030.00915.68
7.0.280.0070.01015.78
7.0.270.0100.00515.57
7.0.260.0110.00615.68
7.0.250.0090.00615.77
7.0.240.0020.01215.84
7.0.230.0070.00415.66
7.0.220.0100.00515.87
7.0.210.0070.00715.62
7.0.200.0040.00816.02
7.0.190.0030.00815.79
7.0.180.0040.00815.74
7.0.170.0090.00615.69
7.0.160.0070.00815.52
7.0.150.0080.00715.87
7.0.140.0070.03117.77
7.0.130.0070.00615.65
7.0.120.0080.00915.66
7.0.110.0050.01015.54
7.0.100.0080.00415.66
7.0.90.0070.00515.67
7.0.80.0100.00515.69
7.0.70.0080.00315.68
7.0.60.0080.03217.22
7.0.50.0070.02016.67
7.0.40.0060.01615.92
7.0.30.0080.02315.91
7.0.20.0120.02815.87
7.0.10.0040.02815.96
7.0.00.0060.03315.84
5.6.400.0060.00614.75
5.6.390.0100.00314.57
5.6.380.0020.01314.61
5.6.370.0090.00314.57
5.6.360.0070.00914.85
5.6.350.0080.00714.52
5.6.340.0050.00914.64
5.6.330.0030.01014.71
5.6.320.0070.00714.82
5.6.310.0040.00714.75
5.6.300.0060.00614.74
5.6.290.0020.01114.58
5.6.280.0090.02716.64
5.6.270.0090.00414.77
5.6.260.0040.00914.66
5.6.250.0050.00914.46
5.6.240.0080.00814.62
5.6.230.0040.00914.62
5.6.220.0070.00414.62
5.6.210.0070.01916.66
5.6.200.0060.03315.77
5.6.190.0030.02816.78
5.6.180.0070.01916.74
5.6.170.0120.02016.64
5.6.160.0050.02116.58
5.6.150.0040.02015.88
5.6.140.0050.03115.93
5.6.130.0070.01715.72
5.6.120.0050.02316.90
5.6.110.0050.01816.81
5.6.100.0130.02316.73
5.6.90.0070.03016.63
5.6.80.0050.01916.52
5.6.70.0080.00614.54
5.6.60.0090.00414.47
5.6.50.0040.01214.58
5.6.40.0070.00814.56
5.6.30.0080.00714.43
5.6.20.0100.00814.38
5.6.10.0040.01014.79
5.6.00.0080.00514.39
5.5.380.0070.00313.03
5.5.370.0050.00513.07
5.5.360.0030.01013.02
5.5.350.1460.01815.51
5.5.340.0040.03214.70
5.5.330.0090.03015.41
5.5.320.0210.01715.46
5.5.310.0130.01815.47
5.5.300.0040.02114.69
5.5.290.0040.01914.77
5.5.280.0070.01615.72
5.5.270.0010.02615.64
5.5.260.0060.02315.62
5.5.250.0060.01815.55
5.5.240.0100.01915.46
5.5.230.0050.00612.86
5.5.220.0050.00712.80
5.5.210.0040.00812.86
5.5.200.0040.00612.94
5.5.190.0050.00912.96
5.5.180.0030.00712.94
5.5.170.0050.00612.88
5.5.160.0050.01012.90
5.5.150.0030.01012.80
5.5.140.0040.01012.86
5.5.130.0050.01112.90
5.5.120.0010.01512.92
5.5.110.0050.00812.86
5.5.100.0050.00512.85
5.5.90.0070.00412.96
5.5.80.0050.00812.81
5.5.70.0020.01313.02
5.5.60.0040.00812.83
5.5.50.0070.00712.99
5.5.40.0040.00612.94
5.5.30.0070.00812.85
5.5.20.0090.00412.86
5.5.10.0070.00712.89
5.5.00.0060.00712.83
5.4.450.0070.02014.11
5.4.440.0090.02014.03
5.4.430.0110.01713.91
5.4.420.0120.01314.15
5.4.410.0120.01414.03
5.4.400.0110.01713.89
5.4.390.0090.01913.87
5.4.380.0100.01713.85
5.4.370.0130.02213.98
5.4.360.0100.01813.74
5.4.350.0130.01713.88
5.4.340.0090.01513.75
5.4.330.0090.00411.30
5.4.320.0090.02413.82
5.4.310.0070.01913.88
5.4.300.0100.01413.69
5.4.290.0080.01913.94
5.4.280.0130.01513.71
5.4.270.0080.01813.86
5.4.260.0110.01813.90
5.4.250.0100.01813.91
5.4.240.0110.02513.81
5.4.230.0120.02913.81
5.4.220.0080.01913.92
5.4.210.0110.01513.96
5.4.200.0080.01713.84
5.4.190.0110.01713.93
5.4.180.0080.01713.81
5.4.170.0080.01613.96
5.4.160.0080.02113.87
5.4.150.0110.02713.85
5.4.140.0070.02212.95
5.4.130.0060.01713.07
5.4.120.0080.01613.04
5.4.110.0120.02013.02
5.4.100.0070.01912.97
5.4.90.0100.01713.00
5.4.80.0080.02013.00
5.4.70.0090.01313.12
5.4.60.0100.02113.11
5.4.50.0080.01613.00
5.4.40.0110.01712.95
5.4.30.0090.01713.07
5.4.20.0040.01912.97
5.4.10.0100.01312.81
5.4.00.0080.01612.82
5.3.290.0110.02612.20
5.3.280.0100.01512.15
5.3.270.0080.01612.21
5.3.260.0100.01412.08
5.3.250.0100.02012.21
5.3.240.0100.01512.07
5.3.230.0070.01712.10
5.3.220.0090.01612.08
5.3.210.0100.01512.11
5.3.200.0080.02212.08
5.3.190.0090.01812.13
5.3.180.0070.02012.17
5.3.170.0070.01712.23
5.3.160.0100.01512.11
5.3.150.0080.01712.07
5.3.140.0070.01712.16
5.3.130.0050.01912.08
5.3.120.0070.02112.09
5.3.110.0070.01712.15
5.3.100.0080.01811.85
5.3.90.0080.01811.93
5.3.80.0060.01811.92
5.3.70.0070.01811.88
5.3.60.0100.01512.03
5.3.50.0060.01911.81
5.3.40.0070.02811.79
5.3.30.0090.01511.86
5.3.20.0110.01311.79
5.3.10.0070.01611.62
5.3.00.0080.01611.61
5.2.170.0100.03510.64
5.2.160.0100.01710.55
5.2.150.0130.03210.51
5.2.140.0100.01610.54
5.2.130.0130.02410.62
5.2.120.0050.01910.57
5.2.110.0100.01510.49
5.2.100.0100.01510.52
5.2.90.0090.01710.58
5.2.80.0090.01710.50
5.2.70.0080.01710.57
5.2.60.0050.02110.55
5.2.50.0150.01310.55
5.2.40.0130.02810.57
5.2.30.0170.02210.46
5.2.20.0090.03510.45
5.2.10.0120.02510.49
5.2.00.0110.01910.33
5.1.60.0080.01610.02
5.1.50.0080.01510.02
5.1.40.0060.01610.05
5.1.30.0090.01310.18
5.1.20.0080.01410.14
5.1.10.0060.01810.02
5.1.00.0100.01310.02
5.0.50.0090.00910.02
5.0.40.0070.02010.02
5.0.30.0070.01510.02
5.0.20.0030.01210.02
5.0.10.0060.01410.02
5.0.00.0060.01510.02
4.4.90.0030.01010.02
4.4.80.0040.01210.02
4.4.70.0100.00710.02
4.4.60.0030.01610.02
4.4.50.0020.01510.02
4.4.40.0030.01610.02
4.4.30.0040.01110.02
4.4.20.0050.00910.02
4.4.10.0050.00910.02
4.4.00.0070.02010.02
4.3.110.0110.01410.02
4.3.100.0050.00810.02
4.3.90.0030.01010.02
4.3.80.0060.01810.02
4.3.70.0040.00910.02
4.3.60.0040.01110.02
4.3.50.0020.01110.02
4.3.40.0000.01710.02
4.3.30.0000.01110.02
4.3.20.0020.00810.02
4.3.10.0020.00810.02
4.3.00.0050.00910.02

preferences:
51.05 ms | 400 KiB | 5 Q