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($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.0150.00017.25
8.3.50.0090.00822.00
8.3.40.0090.00618.96
8.3.30.0070.00719.32
8.3.20.0000.00720.63
8.3.10.0040.00423.90
8.3.00.0110.00020.89
8.2.180.0070.01118.55
8.2.170.0110.00322.96
8.2.160.0100.00322.39
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0060.00322.64
8.2.110.0030.00622.50
8.2.100.0090.00318.22
8.2.90.0060.00318.34
8.2.80.0090.00017.97
8.2.70.0050.00517.88
8.2.60.0050.00318.30
8.2.50.0040.00418.47
8.2.40.0080.00020.88
8.2.30.0050.00321.41
8.2.20.0000.00818.12
8.2.10.0040.00417.95
8.2.00.0030.00617.95
8.1.280.0120.00925.92
8.1.270.0060.00324.12
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0040.00817.73
8.1.230.0120.00421.16
8.1.220.0000.00818.01
8.1.210.0000.00918.92
8.1.200.0030.00617.72
8.1.190.0060.00317.60
8.1.180.0040.00418.10
8.1.170.0000.00818.88
8.1.160.0040.00419.13
8.1.150.0070.00020.40
8.1.140.0000.00717.67
8.1.130.0000.00718.11
8.1.120.0060.00417.79
8.1.110.0040.00417.63
8.1.100.0070.00017.78
8.1.90.0040.00417.72
8.1.80.0000.00717.80
8.1.70.0040.00417.74
8.1.60.0030.00617.80
8.1.50.0030.00617.83
8.1.40.0000.00817.75
8.1.30.0000.00817.98
8.1.20.0050.00317.85
8.1.10.0040.00417.75
8.1.00.0030.00517.80
8.0.300.0030.00620.46
8.0.290.0040.00417.00
8.0.280.0000.00718.73
8.0.270.0050.00217.52
8.0.260.0030.00316.95
8.0.250.0070.00017.25
8.0.240.0080.00317.27
8.0.230.0030.00317.25
8.0.220.0070.00017.20
8.0.210.0000.00717.07
8.0.200.0030.00317.09
8.0.190.0000.00817.16
8.0.180.0080.00017.21
8.0.170.0020.00517.24
8.0.160.0060.00317.06
8.0.150.0040.00417.16
8.0.140.0030.00617.02
8.0.130.0030.00313.53
8.0.120.0090.00017.10
8.0.110.0080.00017.00
8.0.100.0040.00417.16
8.0.90.0000.00817.00
8.0.80.0000.01617.16
8.0.70.0030.00517.03
8.0.60.0000.00817.22
8.0.50.0070.00017.05
8.0.30.0140.00517.27
8.0.20.0100.00917.52
8.0.10.0030.00617.29
8.0.00.0090.00917.30
7.4.330.0050.00015.32
7.4.320.0030.00316.76
7.4.300.0000.00616.75
7.4.290.0040.00416.84
7.4.280.0030.00316.78
7.4.270.0030.00516.85
7.4.260.0000.00816.87
7.4.250.0000.00716.80
7.4.240.0040.00416.79
7.4.230.0000.00716.62
7.4.220.0120.00916.86
7.4.210.0090.00616.81
7.4.200.0000.00816.82
7.4.190.0040.00416.92
7.4.160.0120.00616.87
7.4.150.0140.00717.40
7.4.140.0090.01117.86
7.4.130.0090.01116.79
7.4.120.0100.00816.91
7.4.110.0130.00716.93
7.4.100.0060.01816.83
7.4.90.0090.01516.91
7.4.80.0030.01616.83
7.4.70.0070.01116.88
7.4.60.0070.01116.81
7.4.50.0030.00516.68
7.4.40.0070.00722.77
7.4.30.0150.00316.64
7.4.10.0080.01115.09
7.4.00.0090.00715.32
7.3.330.0030.00313.45
7.3.320.0030.00313.56
7.3.310.0030.00316.64
7.3.300.0060.00016.51
7.3.290.0080.00616.70
7.3.280.0080.00916.63
7.3.270.0140.00317.40
7.3.260.0030.01416.88
7.3.250.0050.01316.82
7.3.240.0090.00916.65
7.3.230.0190.00016.90
7.3.210.0090.00916.61
7.3.200.0160.00519.39
7.3.190.0200.00016.56
7.3.180.0090.00616.70
7.3.170.0070.01016.94
7.3.160.0080.00816.75
7.3.130.0060.01215.04
7.3.120.0080.00914.94
7.3.110.0090.00914.77
7.3.100.0030.00914.72
7.3.90.0100.00315.02
7.3.80.0090.00615.04
7.3.70.0030.00515.11
7.3.60.0060.00915.11
7.3.50.0060.00315.05
7.3.40.0070.00715.02
7.3.30.0040.00714.75
7.3.20.0030.00916.87
7.3.10.0100.00716.82
7.3.00.0060.01316.84
7.2.330.0080.01116.96
7.2.320.0060.01117.06
7.2.310.0060.01017.14
7.2.300.0070.01017.04
7.2.290.0110.00716.88
7.2.260.0100.00714.91
7.2.250.0040.01615.49
7.2.240.0090.00014.96
7.2.230.0030.01315.42
7.2.220.0100.00315.26
7.2.210.0090.00315.24
7.2.200.0160.00014.97
7.2.190.0060.00915.37
7.2.180.0110.00415.28
7.2.170.0080.00415.38
7.2.160.0080.00315.32
7.2.150.0090.00017.25
7.2.140.0060.01016.93
7.2.130.0070.01316.93
7.2.120.0030.01117.14
7.2.110.0000.01617.01
7.2.100.0090.00616.98
7.2.90.0040.00716.85
7.2.80.0120.00417.07
7.2.70.0030.01317.06
7.2.60.0030.01317.01
7.2.50.0030.00616.92
7.2.40.0030.01216.84
7.2.30.0030.01617.18
7.2.20.0070.00717.28
7.2.10.0090.00617.06
7.2.00.0070.00918.27
7.1.330.0040.00415.95
7.1.320.0040.00715.92
7.1.310.0080.00315.82
7.1.300.0050.00516.10
7.1.290.0050.00515.71
7.1.280.0050.00515.75
7.1.270.0070.00715.89
7.1.260.0040.01415.87
7.1.250.0100.00715.67
7.1.240.0080.00615.92
7.1.230.0040.01115.92
7.1.220.0060.01316.02
7.1.210.0100.00016.00
7.1.200.0070.00715.98
7.1.190.0030.01016.09
7.1.180.0030.00615.93
7.1.170.0070.00316.01
7.1.160.0030.01015.97
7.1.150.0000.00915.83
7.1.140.0120.00315.92
7.1.130.0030.01016.02
7.1.120.0070.01015.79
7.1.110.0000.01515.88
7.1.100.0060.00917.03
7.1.90.0100.00715.77
7.1.80.0070.01015.86
7.1.70.0070.00316.58
7.1.60.0050.01417.60
7.1.50.0070.01016.54
7.1.40.0060.00915.95
7.1.30.0030.01315.90
7.1.20.0000.01516.05
7.1.10.0060.01215.68
7.1.00.0040.04019.16
7.0.330.0040.00415.69
7.0.320.0030.00915.55
7.0.310.0030.01015.57
7.0.300.0090.00315.68
7.0.290.0040.01215.44
7.0.280.0000.01015.43
7.0.270.0060.00615.54
7.0.260.0030.01315.43
7.0.250.0030.00715.64
7.0.240.0000.01015.51
7.0.230.0040.00415.36
7.0.220.0060.00815.71
7.0.210.0050.00515.70
7.0.200.0070.00816.29
7.0.190.0100.00615.41
7.0.180.0030.01415.66
7.0.170.0070.01115.87
7.0.160.0090.00615.51
7.0.150.0090.00615.55
7.0.140.0050.03918.87
7.0.130.0080.00415.72
7.0.120.0100.00315.64
7.0.110.0030.00515.68
7.0.100.0000.00915.75
7.0.90.0040.00715.40
7.0.80.0060.00615.66
7.0.70.0030.01015.46
7.0.60.0070.02117.95
7.0.50.0010.04616.86
7.0.40.0050.03216.94
7.0.30.0190.02716.98
7.0.20.0180.04316.99
7.0.10.0050.04517.01
7.0.00.0090.03016.98
5.6.400.0090.00614.49
5.6.390.0030.01014.56
5.6.380.0060.01214.48
5.6.370.0060.00914.45
5.6.360.0030.01014.68
5.6.350.0090.00614.28
5.6.340.0030.00914.21
5.6.330.0030.01314.93
5.6.320.0040.00714.72
5.6.310.0030.00614.82
5.6.300.0000.01114.50
5.6.290.0090.00614.86
5.6.280.0050.04017.95
5.6.270.0060.00814.79
5.6.260.0060.00914.48
5.6.250.0030.00614.61
5.6.240.0040.01114.46
5.6.230.0040.00414.49
5.6.220.0080.00414.60
5.6.210.0080.04417.74
5.6.200.0080.04516.41
5.6.190.0080.02817.67
5.6.180.0110.02217.42
5.6.170.0100.02717.63
5.6.160.0110.02017.65
5.6.150.0030.03316.54
5.6.140.0100.03716.61
5.6.130.0130.04016.48
5.6.120.0070.03017.90
5.6.110.0200.02717.71
5.6.100.0100.04217.76
5.6.90.0100.03617.90
5.6.80.0130.03617.50
5.6.70.0110.00614.79
5.6.60.0000.01414.44
5.6.50.0030.01014.50
5.6.40.0030.01014.32
5.6.30.0050.00514.50
5.6.20.0000.01814.79
5.6.10.0030.01014.71
5.6.00.0030.00714.50
5.5.380.0000.01014.34
5.5.370.0070.01014.66
5.5.360.0100.00714.50
5.5.350.0060.04517.54
5.5.340.0090.04316.22
5.5.330.0050.02617.21
5.5.320.0100.04217.40
5.5.310.0270.01617.49
5.5.300.0030.04516.42
5.5.290.0030.04516.31
5.5.280.0060.03017.77
5.5.270.0070.02817.89
5.5.260.0100.04717.68
5.5.250.0020.02617.54
5.5.240.0080.03217.33
5.5.230.0090.00614.52
5.5.220.0030.01014.36
5.5.210.0090.00614.40
5.5.200.0000.01514.38
5.5.190.0070.00414.37
5.5.180.0000.01314.57
5.5.170.0040.00414.43
5.5.160.0110.00014.33
5.5.150.0030.01314.66
5.5.140.0000.01314.57
5.5.130.0000.01214.54
5.5.120.0080.00414.44
5.5.110.0040.00814.34
5.5.100.0080.00314.32
5.5.90.0040.00714.47
5.5.80.0100.00714.43
5.5.70.0110.00414.31
5.5.60.0030.01314.37
5.5.50.0090.00614.28
5.5.40.0100.00714.32
5.5.30.0000.01214.38
5.5.20.0030.01414.13
5.5.10.0090.00614.43
5.5.00.0070.00314.47
5.4.450.0380.02115.54
5.4.440.0670.02115.47
5.4.430.0640.02315.50
5.4.420.0420.02815.55
5.4.410.0400.02115.42
5.4.400.0650.02315.37
5.4.390.0390.02815.37
5.4.380.0180.03415.18
5.4.370.0200.02615.17
5.4.360.0240.02215.17
5.4.350.0210.02815.10
5.4.340.0210.02915.16
5.4.330.0040.00811.43
5.4.320.0040.02512.06
5.4.310.0050.02512.06
5.4.300.0040.02312.06
5.4.290.0020.02512.06
5.4.280.0070.02012.01
5.4.270.0060.02312.01
5.4.260.0050.02012.01
5.4.250.0050.02112.01
5.4.240.0050.02012.01
5.4.230.0030.02612.00
5.4.220.0020.02512.00
5.4.210.0070.01912.00
5.4.200.0060.02212.00
5.4.190.0110.02512.00
5.4.180.0070.02812.00
5.4.170.0130.02012.00
5.4.160.0130.02212.00
5.4.150.0170.04912.00
5.4.140.0120.02311.91
5.4.130.0080.02611.83
5.4.120.0100.02511.81
5.4.110.0090.02711.81
5.4.100.0110.02411.81
5.4.90.0110.02411.81
5.4.80.0090.02511.81
5.4.70.0100.02211.81
5.4.60.0150.03311.81
5.4.50.0090.02511.81
5.4.40.0110.02311.80
5.4.30.0070.02811.80
5.4.20.0130.03711.80
5.4.10.0110.02311.80
5.4.00.0130.02211.55
5.3.290.0060.02512.19
5.3.280.0050.02412.16
5.3.270.0100.02612.16
5.3.260.0090.02612.16
5.3.250.0070.02912.16
5.3.240.0240.04212.16
5.3.230.0070.02912.15
5.3.220.0080.02812.14
5.3.210.0120.05612.14
5.3.200.0130.02312.14
5.3.190.0130.02412.14
5.3.180.0110.02612.14
5.3.170.0160.03412.14
5.3.160.0110.02312.14
5.3.150.0080.02512.13
5.3.140.0090.02512.13
5.3.130.0130.02312.13
5.3.120.0160.03612.13
5.3.110.0130.04012.13
5.3.100.0130.02511.87
5.3.90.0080.02611.87
5.3.80.0090.02611.86
5.3.70.0080.02711.85
5.3.60.0080.03011.85
5.3.50.0110.03911.82
5.3.40.0120.02311.82
5.3.30.0120.02111.81
5.3.20.0100.02511.69
5.3.10.0090.02611.68
5.3.00.0090.02511.67
5.2.170.0140.0339.41
5.2.160.0130.0349.41
5.2.150.0130.0359.41
5.2.140.0190.0639.41
5.2.130.0120.0379.37
5.2.120.0130.0349.38
5.2.110.0170.0389.38
5.2.100.0330.0749.38
5.2.90.0100.0389.38
5.2.80.0110.0379.37
5.2.70.0160.0339.37
5.2.60.0110.0389.32
5.2.50.0160.0329.29
5.2.40.0140.0349.27
5.2.30.0060.0409.24
5.2.20.0120.0359.24
5.2.10.0140.0329.14
5.2.00.0130.0338.99
5.1.60.0130.0288.27
5.1.50.0120.0298.27
5.1.40.0100.0308.26
5.1.30.0110.0328.60
5.1.20.0110.0318.60
5.1.10.0120.0328.17
5.1.00.0140.0288.16
5.0.50.0100.0246.65
5.0.40.0080.0246.50
5.0.30.0080.0366.32
5.0.20.0070.0256.29
5.0.10.0080.0256.27
5.0.00.0080.0366.26
4.4.90.0090.0154.78
4.4.80.0080.0174.75
4.4.70.0070.0194.76
4.4.60.0320.0554.75
4.4.50.0090.0164.77
4.4.40.0070.0294.70
4.4.30.0060.0214.76
4.4.20.0070.0194.84
4.4.10.0060.0204.85
4.4.00.0060.0314.76
4.3.110.0080.0174.67
4.3.100.0060.0194.66
4.3.90.0050.0204.64
4.3.80.0070.0274.58
4.3.70.0040.0204.63
4.3.60.0070.0174.62
4.3.50.0060.0194.63
4.3.40.0090.0264.54
4.3.30.0040.0203.30
4.3.20.0030.0203.27
4.3.10.0060.0163.24
4.3.00.0070.01312.57

preferences:
50.9 ms | 401 KiB | 5 Q