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)) { $tag = $this->xml->getName(); var_dump($this->xml->xpath('../val[2]'));die; $target = $this->xml->xpath('../' . $tag . '[' . $offset . ']'); $target = $target[0]; return new self($target->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']; echo $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.70.0040.01117.38
8.3.60.0190.00617.13
8.3.50.0070.01022.21
8.3.40.0040.01119.25
8.3.30.0110.00319.51
8.3.20.0050.00320.59
8.3.10.0040.00423.89
8.3.00.0040.00818.13
8.2.180.0070.00718.85
8.2.170.0080.00822.96
8.2.160.0100.00320.72
8.2.150.0040.01124.18
8.2.140.0040.00424.66
8.2.130.0140.00326.16
8.2.120.0070.00022.94
8.2.110.0070.00322.70
8.2.100.0060.00618.22
8.2.90.0000.00819.55
8.2.80.0040.00418.30
8.2.70.0060.00318.00
8.2.60.0050.00318.30
8.2.50.0030.00518.07
8.2.40.0030.00618.59
8.2.30.0000.00818.63
8.2.20.0040.00418.33
8.2.10.0040.00418.52
8.2.00.0000.01118.25
8.1.280.0040.01125.92
8.1.270.0000.01522.69
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00024.21
8.1.230.0060.00619.72
8.1.220.0050.00318.15
8.1.210.0030.00518.77
8.1.200.0060.00317.98
8.1.190.0040.00417.80
8.1.180.0050.00318.10
8.1.170.0060.00319.13
8.1.160.0000.00722.42
8.1.150.0050.00319.09
8.1.140.0050.00517.80
8.1.130.0050.00218.21
8.1.120.0070.00017.96
8.1.110.0040.00417.70
8.1.100.0050.00317.75
8.1.90.0020.00517.73
8.1.80.0000.00817.75
8.1.70.0000.00717.81
8.1.60.0050.00317.99
8.1.50.0000.00817.88
8.1.40.0040.00417.98
8.1.30.0040.00418.02
8.1.20.0000.00917.96
8.1.10.0030.00617.92
8.1.00.0080.00017.83
8.0.300.0090.00018.77
8.0.290.0040.00417.68
8.0.280.0040.00418.79
8.0.270.0000.00717.69
8.0.260.0030.00317.62
8.0.250.0000.00717.51
8.0.240.0070.00317.47
8.0.230.0080.00017.27
8.0.220.0080.00017.21
8.0.210.0000.00717.35
8.0.200.0030.00317.52
8.0.190.0080.00017.29
8.0.180.0040.00417.31
8.0.170.0090.00017.41
8.0.160.0000.00717.20
8.0.150.0080.00017.42
8.0.140.0040.00417.32
8.0.130.0050.00313.79
8.0.120.0080.00017.25
8.0.110.0060.00317.33
8.0.100.0000.00717.24
8.0.90.0030.00617.35
8.0.80.0030.01317.34
8.0.70.0000.00717.43
8.0.60.0050.00217.41
8.0.50.0000.00717.26
8.0.30.0110.00917.62
8.0.20.0100.00917.40
8.0.10.0040.00417.60
8.0.00.0100.00917.17
7.4.330.0000.00515.57
7.4.320.0040.00416.92
7.4.300.0070.00017.01
7.4.290.0030.00316.87
7.4.280.0060.00317.04
7.4.270.0000.00717.05
7.4.260.0000.00816.80
7.4.250.0040.00417.02
7.4.240.0040.00416.98
7.4.230.0000.00716.95
7.4.220.0070.01117.04
7.4.210.0110.00716.98
7.4.200.0040.00416.86
7.4.190.0050.00317.20
7.4.160.0000.01716.98
7.4.150.0150.00917.40
7.4.140.0120.00817.86
7.4.130.0070.01016.92
7.4.120.0090.00916.98
7.4.110.0100.01416.83
7.4.100.0060.01217.02
7.4.90.0100.00717.03
7.4.80.0090.01319.39
7.4.70.0060.01116.89
7.4.60.0130.00617.11
7.4.50.0040.00416.92
7.4.40.0030.01222.77
7.4.30.0100.00617.07
7.4.00.0000.01815.22
7.3.330.0030.00313.70
7.3.320.0030.00313.51
7.3.310.0000.00716.83
7.3.300.0070.00016.75
7.3.290.0060.01316.84
7.3.280.0060.01216.86
7.3.270.0080.01117.40
7.3.260.0140.00316.89
7.3.250.0080.01017.03
7.3.240.0090.01316.79
7.3.230.0140.00017.00
7.3.210.0150.00616.78
7.3.200.0090.01219.39
7.3.190.0070.01316.96
7.3.180.0140.00316.89
7.3.170.0030.01316.94
7.3.160.0130.00416.80
7.3.120.0100.00614.97
7.3.10.0030.01016.71
7.3.00.0080.00416.54
7.2.330.0100.00917.09
7.2.320.0150.00317.17
7.2.310.0070.01017.21
7.2.300.0130.00316.90
7.2.290.0170.00017.26
7.2.130.0040.01116.90
7.2.120.0060.00716.97
7.2.110.0070.00716.88
7.2.100.0080.00516.98
7.2.90.0120.00316.92
7.2.80.0060.00716.96
7.2.70.0070.00716.99
7.2.60.0050.00616.93
7.2.50.0050.00917.23
7.2.40.0080.00917.17
7.2.30.0130.00717.06
7.2.20.0060.00816.99
7.2.10.0160.00516.99
7.2.00.0100.00317.04
7.1.250.0040.00915.65
7.1.240.0040.01115.97
7.1.230.0090.00015.89
7.1.220.0120.00316.00
7.1.210.0080.00415.87
7.1.200.0050.00716.01
7.1.190.0030.00615.88
7.1.180.0070.00715.92
7.1.170.0080.00316.14
7.1.160.0000.01216.00
7.1.150.0030.00615.71
7.1.140.0040.00815.79
7.1.130.0070.00716.07
7.1.120.0070.00716.04
7.1.110.0030.00715.95
7.1.100.0050.00717.19
7.1.90.0030.00615.78
7.1.80.0100.00016.01
7.1.70.0040.00816.49
7.1.60.0060.01417.68
7.1.50.0100.00916.59
7.1.40.0000.01015.88
7.1.30.0030.00915.86
7.1.20.0060.00916.02
7.1.10.0070.00715.92
7.1.00.0050.04119.15
7.0.330.0030.00915.41
7.0.320.0110.00315.60
7.0.310.0040.00915.30
7.0.300.0030.00715.53
7.0.290.0060.00915.47
7.0.280.0100.00315.46
7.0.270.0080.00415.71
7.0.260.0000.00915.45
7.0.250.0130.00315.54
7.0.240.0080.00015.64
7.0.230.0000.01415.58
7.0.220.0000.01215.61
7.0.210.0030.01315.51
7.0.200.0030.00716.37
7.0.190.0060.00615.36
7.0.180.0080.00815.60
7.0.170.0060.00615.43
7.0.160.0000.01215.62
7.0.150.0070.00415.50
7.0.140.0050.04918.90
7.0.130.0130.00015.67
7.0.120.0080.00815.48
7.0.110.0090.00615.46
7.0.100.0000.00815.60
7.0.90.0070.00415.63
7.0.80.0030.01015.49
7.0.70.0080.00315.54
7.0.60.0080.04317.81
7.0.50.0020.03116.81
7.0.40.0070.04317.02
7.0.30.0130.04216.98
7.0.20.0140.02117.02
7.0.10.0120.02517.07
7.0.00.0050.04816.91
5.6.380.0030.00714.43
5.6.370.0080.00414.23
5.6.360.0060.00614.61
5.6.350.0110.00014.49
5.6.340.0030.01314.52
5.6.330.0090.00314.48
5.6.320.0030.00614.66
5.6.310.0070.00514.61
5.6.300.0040.00814.43
5.6.290.0090.00614.86
5.6.280.0030.04317.85
5.6.270.0070.00714.21
5.6.260.0060.01114.60
5.6.250.0090.00014.41
5.6.240.0080.00314.54
5.6.230.0000.00814.89
5.6.220.0060.00614.53
5.6.210.0080.03317.55
5.6.200.0030.03416.42
5.6.190.0020.04717.52
5.6.180.0080.03217.78
5.6.170.0170.03617.73
5.6.160.0090.04217.68
5.6.150.0030.03916.52
5.6.140.0070.03416.30
5.6.130.0080.04016.56
5.6.120.0100.03317.94
5.6.110.0020.02918.00
5.6.100.0070.03717.83
5.6.90.0050.04517.78
5.6.80.0080.03717.47
5.6.70.1880.02517.53
5.6.60.0040.01114.51
5.6.50.0000.01014.53
5.6.40.0040.00914.79
5.6.30.0070.00414.30
5.6.20.0070.00314.55
5.6.10.0000.01514.38
5.6.00.0080.00014.41
5.5.380.0090.00311.27
5.5.370.0000.00811.49
5.5.360.0030.00511.43
5.5.350.0060.04916.01
5.5.340.0030.03914.80
5.5.330.0000.02915.85
5.5.320.0000.02816.03
5.5.310.0130.04116.03
5.5.300.0030.03414.77
5.5.290.0030.03314.76
5.5.280.0040.02216.26
5.5.270.0030.04516.30
5.5.260.0080.04116.21
5.5.250.0080.04116.22
5.5.240.0100.04215.85
5.5.230.0000.00711.42
5.5.220.0020.00511.41
5.5.210.0000.00811.50
5.5.200.0080.00011.25
5.5.190.0060.00611.46
5.5.180.0050.00511.14
5.5.170.0000.01011.29
5.5.160.0030.00511.46
5.5.150.0040.00411.33
5.5.140.0030.00911.54
5.5.130.0050.00311.13
5.5.120.0000.00611.42
5.5.110.0000.00911.26
5.5.100.0070.00011.34
5.5.90.0020.00511.36
5.5.80.0050.00211.18
5.5.70.0050.00011.19
5.5.60.0050.00911.21
5.5.50.0030.01011.44
5.5.40.0030.00611.31
5.5.30.0000.00711.21
5.5.20.0030.00311.35
5.5.10.0110.00711.41
5.5.00.0050.00311.20
5.4.450.0080.04215.49
5.4.440.0190.03515.39
5.4.430.0210.03515.18
5.4.420.0100.03215.29
5.4.410.0230.03115.30
5.4.400.0110.03115.40
5.4.390.0220.02315.29
5.4.380.0190.03615.03
5.4.370.0150.03414.95
5.4.360.0170.03015.09
5.4.350.0150.04215.01
5.4.340.0130.03315.05
5.4.330.0040.00411.28
5.4.320.0070.02212.02
5.4.310.0060.02311.96
5.4.300.0060.02012.05
5.4.290.0040.02311.89
5.4.280.0060.01811.88
5.4.270.0050.01912.03
5.4.260.0050.02712.04
5.4.250.0020.02511.95
5.4.240.0020.02411.93
5.4.230.0030.02211.83
5.4.220.0080.01712.03
5.4.210.0060.02511.85
5.4.200.0070.02112.01
5.4.190.0100.02311.98
5.4.180.0080.02611.81
5.4.170.0100.02411.92
5.4.160.0140.03712.01
5.4.150.0090.02512.00
5.4.140.0130.02011.77
5.4.130.0100.02411.83
5.4.120.0130.02211.85
5.4.110.0140.02011.65
5.4.100.0090.02711.65
5.4.90.0100.02511.74
5.4.80.0090.02411.84
5.4.70.0090.02311.74
5.4.60.0090.02511.67
5.4.50.0080.02411.64
5.4.40.0080.02611.75
5.4.30.0110.02011.77
5.4.20.0100.02211.76
5.4.10.0100.02211.70
5.4.00.0090.02611.64
5.3.290.0040.02811.90
5.3.280.0060.02411.79
5.3.270.0090.02611.88
5.3.260.0100.03911.83
5.3.250.0110.02211.88
5.3.240.0100.02611.82
5.3.230.0070.03111.83
5.3.220.0140.03611.76
5.3.210.0140.02211.76
5.3.200.0120.02211.71
5.3.190.0130.03611.79
5.3.180.0070.02711.95
5.3.170.0100.02511.80
5.3.160.0080.02711.80
5.3.150.0090.02611.87
5.3.140.0120.02311.83
5.3.130.0140.02411.79
5.3.120.0120.02311.79
5.3.110.0140.02111.88
5.3.100.0090.02611.62
5.3.90.0090.02411.59
5.3.80.0170.04811.48
5.3.70.0100.02511.58
5.3.60.0090.02311.55
5.3.50.0100.02611.51
5.3.40.0140.02011.52
5.3.30.0080.02411.58
5.3.20.0100.02411.30
5.3.10.0090.02311.26
5.3.00.0110.03911.19
5.2.170.0100.0199.87
5.2.160.0150.0269.87
5.2.150.0090.0189.87
5.2.140.0080.0229.87
5.2.130.0070.0209.85
5.2.120.0110.0179.85
5.2.110.0060.0229.85
5.2.100.0220.0369.85
5.2.90.0100.0199.85
5.2.80.0070.0209.84
5.2.70.0100.0199.84
5.2.60.0070.0219.82
5.2.50.0070.0209.80
5.2.40.0110.0179.79
5.2.30.0090.0199.78
5.2.20.0060.0259.77
5.2.10.0150.0199.73
5.2.00.0120.0179.65
5.1.60.0110.0189.30
5.1.50.0080.0179.30
5.1.40.0100.0169.29
5.1.30.0130.0159.47
5.1.20.0090.0189.41
5.1.10.0100.0179.20
5.1.00.0110.0179.20
5.0.50.0090.0138.45
5.0.40.0110.0108.37
5.0.30.0050.0238.28
5.0.20.0070.0158.27
5.0.10.0140.0128.25
5.0.00.0080.0178.25
4.4.90.0060.0107.51
4.4.80.0040.0127.49
4.4.70.0060.0107.49
4.4.60.0040.0127.49
4.4.50.0080.0097.50
4.4.40.0100.0187.47
4.4.30.0200.0277.50
4.4.20.0080.0117.54
4.4.10.0060.0127.54
4.4.00.0080.0277.50
4.3.110.0060.0107.45
4.3.100.0080.0097.45
4.3.90.0090.0097.43
4.3.80.0050.0187.41
4.3.70.0110.0087.43
4.3.60.0080.0097.43
4.3.50.0050.0137.43
4.3.40.0080.0157.38
4.3.30.0130.0346.77
4.3.20.0050.0116.75
4.3.10.0040.0116.74
4.3.00.0040.0149.01

preferences:
36.53 ms | 401 KiB | 5 Q