3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; private $filePath; private $isUrl; 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; } return new self($this->xml->$offset->asXML(), false); } 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((string)$xml['note']['recursive']);

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.0110.00818.81
8.3.50.0250.00722.25
8.3.40.0140.00419.28
8.3.30.0110.00419.52
8.3.20.0000.00820.64
8.3.10.0030.00522.17
8.3.00.0040.00422.70
8.2.180.0070.00718.79
8.2.170.0160.00322.96
8.2.160.0110.00321.18
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.01119.86
8.2.110.0100.00022.48
8.2.100.0140.00018.16
8.2.90.0080.00019.35
8.2.80.0040.00418.18
8.2.70.0060.00318.00
8.2.60.0000.00818.18
8.2.50.0080.00018.07
8.2.40.0080.00018.47
8.2.30.0040.00418.46
8.2.20.0080.00017.97
8.2.10.0030.00617.97
8.2.00.0000.00717.95
8.1.280.0110.00425.92
8.1.270.0080.00024.10
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0060.00324.21
8.1.230.0080.00319.39
8.1.220.0040.00418.03
8.1.210.0050.00318.77
8.1.200.0000.00917.60
8.1.190.0000.00917.77
8.1.180.0080.00018.10
8.1.170.0060.00318.72
8.1.160.0050.00222.25
8.1.150.0060.00318.94
8.1.140.0040.00417.73
8.1.130.0030.00318.06
8.1.120.0040.00417.63
8.1.110.0040.00717.74
8.1.100.0040.00417.75
8.1.90.0000.00717.71
8.1.80.0030.00617.64
8.1.70.0030.00317.63
8.1.60.0030.00517.77
8.1.50.0030.00617.68
8.1.40.0040.00417.85
8.1.30.0050.00517.97
8.1.20.0030.00617.91
8.1.10.0080.00017.79
8.1.00.0030.00617.80
8.0.300.0070.00018.77
8.0.290.0000.00717.53
8.0.280.0030.00318.71
8.0.270.0030.00317.54
8.0.260.0030.00317.23
8.0.250.0030.00317.25
8.0.240.0090.00317.23
8.0.230.0000.00717.29
8.0.220.0000.00817.13
8.0.210.0000.00717.19
8.0.200.0030.00317.30
8.0.190.0030.00517.29
8.0.180.0000.00717.23
8.0.170.0030.00617.24
8.0.160.0000.00817.11
8.0.150.0030.00317.17
8.0.140.0000.00717.21
8.0.130.0000.00613.69
8.0.120.0050.00217.27
8.0.110.0040.00417.22
8.0.100.0040.00417.29
8.0.90.0040.00417.13
8.0.80.0060.00917.11
8.0.70.0030.00617.11
8.0.60.0050.00317.26
8.0.50.0070.00017.11
8.0.30.0090.01217.35
8.0.20.0060.01317.53
8.0.10.0070.00017.46
8.0.00.0090.01316.84
7.4.330.0050.00215.40
7.4.320.0000.00716.84
7.4.300.0040.00416.93
7.4.290.0040.00416.82
7.4.280.0050.00316.92
7.4.270.0070.00016.73
7.4.260.0070.00016.89
7.4.250.0040.00416.87
7.4.240.0080.00016.84
7.4.230.0050.00316.77
7.4.220.0120.00616.96
7.4.210.0080.00916.82
7.4.200.0040.00416.71
7.4.190.0000.00916.58
7.4.160.0060.01116.74
7.4.150.0030.01417.40
7.4.140.0150.00717.86
7.4.130.0170.01316.62
7.4.120.0070.01016.71
7.4.110.0140.00316.74
7.4.100.0120.00616.60
7.4.90.0040.01316.61
7.4.80.0030.01516.69
7.4.70.0080.00816.86
7.4.60.0100.00716.74
7.4.50.0000.00916.42
7.4.40.0080.00222.77
7.4.30.0100.00716.91
7.4.00.0110.00615.24
7.3.330.0000.00513.55
7.3.320.0060.00013.68
7.3.310.0040.00416.80
7.3.300.0000.00816.71
7.3.290.0070.00716.66
7.3.280.0100.00916.68
7.3.270.0110.00617.40
7.3.260.0150.00916.67
7.3.250.0100.01016.80
7.3.240.0160.00316.82
7.3.230.0100.00716.75
7.3.210.0060.01216.89
7.3.200.0160.00619.39
7.3.190.0130.01016.83
7.3.180.0130.00316.89
7.3.170.0100.00716.65
7.3.160.0060.00916.79
7.3.120.0060.01014.83
7.3.110.0070.01115.23
7.3.100.0000.01515.39
7.3.90.0070.00414.94
7.3.80.0070.00715.02
7.3.70.0090.00915.05
7.3.60.0000.01414.92
7.3.50.0110.00414.95
7.3.40.0000.01314.84
7.3.30.0030.00915.02
7.3.20.0030.01016.78
7.3.10.0070.00416.72
7.3.00.0040.01116.70
7.2.330.0120.01217.01
7.2.320.0100.01417.07
7.2.310.0100.01017.07
7.2.300.0070.01016.88
7.2.290.0060.01217.00
7.2.250.0030.01014.95
7.2.240.0070.01415.28
7.2.230.0090.00615.36
7.2.220.0070.01015.36
7.2.210.0080.00815.32
7.2.200.0110.00315.14
7.2.190.0070.00614.82
7.2.180.0080.00615.05
7.2.170.0000.01415.31
7.2.60.0000.01317.09
7.2.00.0000.01819.68
7.1.330.0090.00315.81
7.1.320.0040.00815.84
7.1.310.0070.01016.18
7.1.300.0040.00715.82
7.1.290.0060.00615.76
7.1.280.0060.00615.95
7.1.270.0070.00315.84
7.1.260.0030.00815.94
7.1.200.0000.01215.88
7.1.100.0060.00618.28
7.1.70.0000.01017.19
7.1.60.0110.01419.82
7.1.50.0070.01116.98
7.1.00.0030.07722.52
7.0.200.0040.00416.85
7.0.140.0030.07022.20
7.0.60.0100.08019.95
7.0.50.0030.06718.05
7.0.40.0100.03720.05
7.0.30.0330.06020.29
7.0.20.0330.07020.28
7.0.10.0270.04320.24
7.0.00.0000.06320.31
5.6.280.0130.06021.09
5.6.210.0030.05020.58
5.6.200.0130.07018.32
5.6.190.0030.07720.49
5.6.180.0230.05020.74
5.6.170.0500.07720.71
5.6.160.0100.08320.63
5.6.150.0100.07718.36
5.6.140.0030.09018.38
5.6.130.0030.04718.23
5.6.120.0070.04721.17
5.6.110.0130.08021.20
5.6.100.0200.07321.17
5.6.90.0100.06321.20
5.6.80.0030.08020.61
5.6.70.4100.03720.60
5.5.350.0300.07320.53
5.5.340.0100.05318.12
5.5.330.0070.08720.66
5.5.320.2000.05720.66
5.5.310.0300.07720.58
5.5.300.0070.06318.02
5.5.290.0070.08318.16
5.5.280.0000.07720.87
5.5.270.0070.08020.86
5.5.260.0170.07021.07
5.5.250.0100.06720.68
5.5.240.0100.08020.21
5.4.450.0130.05319.79
5.4.440.0700.06319.53
5.4.430.0270.07319.62
5.4.420.0100.05319.52
5.4.410.0200.06318.79
5.4.400.0170.06018.89
5.4.390.0170.04318.95
5.4.380.0130.06018.93
5.4.370.0170.04718.67
5.4.360.0100.05318.73
5.4.350.0170.05318.58
5.4.340.0070.06018.84
5.4.320.0040.04012.69
5.4.310.0050.04112.68
5.4.300.0050.04112.69
5.4.290.0050.04012.69
5.4.280.0070.03312.59
5.4.270.0030.04712.58
5.4.260.0080.03612.59
5.4.250.0080.03512.59
5.4.240.0060.03612.58
5.4.230.0040.03812.57
5.4.220.0020.04012.58
5.4.210.0090.03112.58
5.4.200.0050.03812.58
5.4.190.0200.04112.57
5.4.180.0160.04812.56
5.4.170.0230.03912.58
5.4.160.0150.04612.57
5.4.150.0160.04712.57
5.4.140.0190.04512.25
5.4.130.0150.04712.24
5.4.120.0160.04412.20
5.4.110.0160.04412.20
5.4.100.0170.04712.20
5.4.90.0150.04612.20
5.4.80.0150.04612.20
5.4.70.0230.04012.18
5.4.60.0160.04512.19
5.4.50.0140.04712.18
5.4.40.0260.06512.17
5.4.30.0170.04512.16
5.4.20.0160.04312.16
5.4.10.0180.04012.16
5.4.00.0120.04611.66
5.3.290.0060.04012.96
5.3.280.0080.03512.88
5.3.270.0240.04112.89
5.3.260.0150.04812.88
5.3.250.0260.03712.88
5.3.240.0120.05012.88
5.3.230.0200.04612.87
5.3.220.0150.04612.84
5.3.210.0160.04612.84
5.3.200.0140.05112.84
5.3.190.0180.04412.84
5.3.180.0140.04812.84
5.3.170.0180.04212.84
5.3.160.0100.05012.84
5.3.150.0150.04812.84
5.3.140.0130.04912.83
5.3.130.0190.04412.83
5.3.120.0210.04012.83
5.3.110.0180.04412.82
5.3.100.0190.04212.32
5.3.90.0190.04012.30
5.3.80.0140.04812.29
5.3.70.0150.04912.28
5.3.60.0160.04712.26
5.3.50.0170.04312.21
5.3.40.0210.04112.21
5.3.30.0120.04712.18
5.3.20.0230.04211.96
5.3.10.0230.04011.93
5.3.00.0190.04511.91
5.2.170.0140.0369.41
5.2.160.0120.0409.41
5.2.150.0160.0359.40
5.2.140.0130.0369.40
5.2.130.0160.0339.37
5.2.120.0120.0389.37
5.2.110.0150.0349.37
5.2.100.0100.0409.37
5.2.90.0130.0359.36
5.2.80.0170.0359.36
5.2.70.0120.0379.36
5.2.60.0150.0349.32
5.2.50.0120.0369.28
5.2.40.0090.0419.26
5.2.30.0140.0339.24
5.2.20.0150.0349.23
5.2.10.0180.0309.13
5.2.00.0170.0338.97
5.1.60.0100.0328.27
5.1.50.0130.0298.27
5.1.40.0110.0308.25
5.1.30.0140.0298.60
5.1.20.0150.0298.59
5.1.10.0130.0338.17
5.1.00.0090.0348.16
5.0.50.0150.0246.65
5.0.40.0090.0246.50
5.0.30.0110.0356.32
5.0.20.0090.0266.29
5.0.10.0130.0206.27
5.0.00.0120.0336.26
4.4.90.0090.0174.78
4.4.80.0070.0184.76
4.4.70.0080.0184.76
4.4.60.0120.0144.76
4.4.50.0070.0194.77
4.4.40.0070.0294.71
4.4.30.0080.0194.76
4.4.20.0110.0164.85
4.4.10.0080.0184.85
4.4.00.0080.0284.76
4.3.110.0090.0194.67
4.3.100.0130.0134.66
4.3.90.0080.0184.63
4.3.80.0090.0274.58
4.3.70.0060.0204.63
4.3.60.0060.0214.63
4.3.50.0120.0154.63
4.3.40.0110.0264.54
4.3.30.0070.0193.30
4.3.20.0060.0193.27
4.3.10.0050.0213.24
4.3.00.0000.02013.09

preferences:
40.27 ms | 401 KiB | 5 Q