3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XmlArrayAccessIterator implements ArrayAccess, IteratorAggregate { private $xml; private $arrayObject; public function __construct($filePath, $isUrl = true) { $this->isUrl = $isUrl; $this->xml = new SimpleXmlIterator($filePath, 0, $isUrl); $this->arrayObject = new ArrayObject(); } public function offsetExists($offset) { return !is_null($this->offsetGet($offset)); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } return $this->arrayObject->exchangeArray((array)$this->xml->$offset); } 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; } public function __toString() { return (string) $this->arrayObject[0]; } } $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'][0];

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.0090.00918.68
8.3.50.0140.00522.07
8.3.40.0150.00718.88
8.3.30.0140.00719.15
8.3.20.0030.00620.56
8.3.10.0080.00022.21
8.3.00.0000.00822.51
8.2.180.0100.00718.91
8.2.170.0090.01222.96
8.2.160.0110.00421.14
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00419.63
8.2.110.0090.00022.29
8.2.100.0040.00818.09
8.2.90.0030.00519.34
8.2.80.0000.00918.05
8.2.70.0040.00417.88
8.2.60.0060.00318.29
8.2.50.0000.00818.07
8.2.40.0070.00418.45
8.2.30.0000.00718.26
8.2.20.0050.00218.07
8.2.10.0000.00817.95
8.2.00.0040.00418.01
8.1.280.0120.00325.92
8.1.270.0050.00324.21
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00623.85
8.1.230.0080.00419.25
8.1.220.0050.00317.91
8.1.210.0030.00618.77
8.1.200.0030.00617.48
8.1.190.0060.00317.66
8.1.180.0030.00618.10
8.1.170.0070.00418.66
8.1.160.0070.00022.22
8.1.150.0040.00418.88
8.1.140.0040.00417.69
8.1.130.0000.00718.01
8.1.120.0070.00017.71
8.1.110.0000.00817.69
8.1.100.0020.00517.59
8.1.90.0040.00417.76
8.1.80.0030.00317.58
8.1.70.0000.00717.63
8.1.60.0000.00917.70
8.1.50.0000.00817.64
8.1.40.0080.00017.68
8.1.30.0030.00517.79
8.1.20.0000.00917.93
8.1.10.0030.00617.85
8.1.00.0040.00417.79
8.0.300.0000.00818.77
8.0.290.0070.00017.18
8.0.280.0070.00018.69
8.0.270.0040.00417.37
8.0.260.0000.00817.06
8.0.250.0000.00717.28
8.0.240.0040.00417.20
8.0.230.0000.00717.25
8.0.220.0070.00017.16
8.0.210.0070.00017.05
8.0.200.0030.00317.27
8.0.190.0040.00417.23
8.0.180.0040.00417.11
8.0.170.0000.00817.26
8.0.160.0030.00517.17
8.0.150.0000.00817.21
8.0.140.0000.00717.06
8.0.130.0030.00313.58
8.0.120.0040.00417.19
8.0.110.0000.00717.21
8.0.100.0040.00417.21
8.0.90.0040.00417.17
8.0.80.0040.01317.21
8.0.70.0050.00317.20
8.0.60.0040.00417.09
8.0.50.0050.00316.95
8.0.30.0170.00517.51
8.0.20.0110.00817.40
8.0.10.0040.00417.13
8.0.00.0100.01117.18
7.4.330.0000.00515.21
7.4.320.0030.00316.71
7.4.300.0000.00716.70
7.4.290.0030.00316.66
7.4.280.0030.00316.74
7.4.270.0000.00716.87
7.4.260.0040.00416.74
7.4.250.0000.00716.68
7.4.240.0050.00216.84
7.4.230.0000.00716.77
7.4.220.0040.01316.71
7.4.210.0050.00916.82
7.4.200.0000.00816.67
7.4.190.0000.00716.75
7.4.160.0110.00616.57
7.4.150.0080.00917.40
7.4.140.0110.00917.86
7.4.130.0100.00916.76
7.4.120.0090.00916.82
7.4.110.0070.01016.95
7.4.100.0040.01416.87
7.4.90.0060.01216.64
7.4.80.0180.00016.61
7.4.70.0030.01316.63
7.4.60.0060.01016.68
7.4.50.0060.00316.65
7.4.40.0030.01022.77
7.4.30.0060.00916.71
7.4.10.0080.00915.87
7.4.00.0070.00915.67
7.3.330.0000.00513.54
7.3.320.0030.00313.51
7.3.310.0040.00416.52
7.3.300.0030.00316.70
7.3.290.0030.01216.63
7.3.280.0100.00916.63
7.3.270.0070.01017.40
7.3.260.0190.00316.70
7.3.250.0100.01116.60
7.3.240.0040.01216.86
7.3.230.0100.00716.68
7.3.210.0110.01116.71
7.3.200.0040.01719.39
7.3.190.0130.00416.68
7.3.180.0080.01116.59
7.3.170.0090.00916.64
7.3.160.0160.00616.76
7.3.130.0090.00815.77
7.3.120.0060.01115.49
7.3.110.0050.00915.89
7.3.100.0060.00915.79
7.3.90.0080.00815.72
7.3.80.0060.00815.68
7.3.70.0040.01215.67
7.3.60.0050.00815.75
7.3.50.0080.00815.71
7.3.40.0060.00815.91
7.3.30.0030.01015.90
7.3.20.0070.00317.66
7.3.10.0000.01517.47
7.3.00.0020.00917.58
7.2.330.0120.00616.70
7.2.320.0120.00616.97
7.2.310.0090.00917.00
7.2.300.0070.01016.75
7.2.290.0030.01416.97
7.2.260.0080.01115.97
7.2.250.0080.01116.11
7.2.240.0040.01115.95
7.2.230.0070.01016.11
7.2.220.0030.01115.94
7.2.210.0060.00915.86
7.2.200.0060.00715.99
7.2.190.0000.01315.96
7.2.180.0020.01115.85
7.2.170.0050.01015.90
7.2.160.0050.00915.96
7.2.150.0070.00317.79
7.2.140.0050.01017.77
7.2.130.0080.00717.82
7.2.120.0050.00817.83
7.2.110.0080.00717.85
7.2.100.0090.00517.78
7.2.90.0040.01117.71
7.2.80.0020.01317.87
7.2.70.0050.01117.87
7.2.60.0110.00517.63
7.2.50.0030.01217.87
7.2.40.0030.01217.91
7.2.30.0060.01017.91
7.2.20.0070.00617.68
7.2.10.0060.00717.78
7.2.00.0030.01118.47
7.1.330.0070.00816.71
7.1.320.0020.01216.76
7.1.310.0020.00916.82
7.1.300.0050.00716.82
7.1.290.0070.00716.71
7.1.280.0030.01516.71
7.1.270.0080.00816.61
7.1.260.0080.00716.76
7.1.250.0100.00416.59
7.1.240.0070.00216.79
7.1.230.0080.00816.63
7.1.220.0070.00816.71
7.1.210.0080.00616.85
7.1.200.0040.00916.38
7.1.190.0040.00916.65
7.1.180.0050.01016.68
7.1.170.0090.00816.65
7.1.160.0080.00616.72
7.1.150.0020.01316.68
7.1.140.0070.00716.58
7.1.130.0000.01516.62
7.1.120.0050.00916.61
7.1.110.0050.00916.63
7.1.100.0060.00817.32
7.1.90.0060.01016.75
7.1.80.0040.00916.65
7.1.70.0040.00616.87
7.1.60.0030.01217.64
7.1.50.0050.01016.78
7.1.40.0080.00516.73
7.1.30.0050.00816.71
7.1.20.0100.00616.63
7.1.10.0060.00816.67
7.1.00.0040.03018.70
7.0.330.0020.01016.25
7.0.320.0070.00616.37
7.0.310.0050.00716.18
7.0.300.0040.01116.36
7.0.290.0040.00916.27
7.0.280.0040.00816.35
7.0.270.0050.01116.16
7.0.260.0000.01216.35
7.0.250.0030.00916.44
7.0.240.0120.00516.29
7.0.230.0080.00716.45
7.0.220.0000.01216.46
7.0.210.0070.00916.36
7.0.200.0050.00916.56
7.0.190.0060.00916.32
7.0.180.0070.00916.31
7.0.170.0060.00616.36
7.0.160.0030.00716.38
7.0.150.0060.01016.29
7.0.140.0080.02318.34
7.0.130.0080.00616.18
7.0.120.0030.00916.38
7.0.110.0060.03217.49
7.0.100.0040.03617.65
7.0.90.0070.03417.55
7.0.80.0060.03117.54
7.0.70.0060.03117.63
7.0.60.0060.02217.40
7.0.50.0030.03717.70
7.0.40.0050.03016.25
7.0.30.0080.02916.29
7.0.20.0070.03116.24
7.0.10.0090.03016.20
7.0.00.0070.02016.16
5.6.400.0050.00815.11
5.6.390.0060.00715.38
5.6.380.0070.00815.08
5.6.370.0040.01015.28
5.6.360.0100.00515.29
5.6.350.0060.01115.40
5.6.340.0020.01115.52
5.6.330.0030.01315.17
5.6.320.0070.00815.29
5.6.310.0060.00815.53
5.6.300.0060.01015.39
5.6.290.0060.01015.33
5.6.280.0110.02417.38
5.6.270.0080.00515.34
5.6.260.0030.01315.28
5.6.250.0080.02917.07
5.6.240.0080.03217.13
5.6.230.0060.03017.19
5.6.220.0050.03117.18
5.6.210.0080.03017.15
5.6.200.0070.02317.12
5.6.190.0040.03517.27
5.6.180.0090.02417.22
5.6.170.0060.02817.33
5.6.160.0110.01917.17
5.6.150.0080.03017.29
5.6.140.0070.03317.33
5.6.130.0100.03017.30
5.6.120.0110.02517.29
5.6.110.0070.03217.31
5.6.100.0070.02617.30
5.6.90.0100.03117.13
5.6.80.0090.03316.89
5.6.70.0070.03216.87
5.6.60.0030.03417.01
5.6.50.0050.02216.92
5.6.40.0080.02816.89
5.6.30.0090.03016.88
5.6.20.0070.03016.93
5.6.10.0080.03016.84
5.6.00.0110.02816.88
5.5.380.0090.02617.11
5.5.370.0110.02617.05
5.5.360.0060.03416.97
5.5.350.0130.02016.93
5.5.340.0090.02917.15
5.5.330.0080.02917.17
5.5.320.0030.02417.04
5.5.310.0090.03117.27
5.5.300.0070.03217.05
5.5.290.0050.03517.04
5.5.280.0080.02117.27
5.5.270.0050.03417.20
5.5.260.0060.03117.27
5.5.250.0050.03217.06
5.5.240.0070.02116.97
5.5.230.0100.02816.90
5.5.220.0070.02916.85
5.5.210.0090.02516.85
5.5.200.0070.03116.96
5.5.190.0070.02917.00
5.5.180.0060.03216.96
5.5.170.0060.00815.14
5.5.160.0080.02116.98
5.5.150.0060.02916.80
5.5.140.0080.02216.79
5.5.130.0090.02917.02
5.5.120.0070.03016.90
5.5.110.0050.03116.84
5.5.100.0060.02017.01
5.5.90.0070.03116.93
5.5.80.0070.03216.84
5.5.70.0070.02916.71
5.5.60.0030.03416.77
5.5.50.0050.03116.79
5.5.40.0080.02216.85
5.5.30.0070.03116.90
5.5.20.0070.01616.89
5.5.10.0010.03516.98
5.5.00.0040.03016.86
5.4.450.0030.03214.66
5.4.440.0050.03314.63
5.4.430.0030.02014.58
5.4.420.0040.03114.78
5.4.410.0040.03114.73
5.4.400.0030.03214.58
5.4.390.0060.02814.54
5.4.380.0040.01914.57
5.4.370.0090.02514.44
5.4.360.0090.02114.47
5.4.350.0060.01914.53
5.4.340.0090.02514.44
5.4.330.0090.00212.14
5.4.320.0030.03214.46
5.4.310.0080.01614.49
5.4.300.0060.02814.57
5.4.290.0020.03114.52
5.4.280.0040.01914.38
5.4.270.0050.02814.47
5.4.260.0050.03114.53
5.4.250.0060.01914.41
5.4.240.0030.03014.27
5.4.230.0080.02314.32
5.4.220.0090.02514.41
5.4.210.0090.02814.39
5.4.200.0040.03214.28
5.4.190.0070.02514.42
5.4.180.0040.03114.41
5.4.170.0090.02814.46
5.4.160.0110.02514.43
5.4.150.0040.02214.52
5.4.140.0050.02913.58
5.4.130.0060.02913.43
5.4.120.0060.02213.55
5.4.110.0080.02013.63
5.4.100.0060.01713.72
5.4.90.0030.02113.69
5.4.80.0030.01613.48
5.4.70.0030.01713.58
5.4.60.0060.01413.60
5.4.50.0040.01613.45
5.4.40.0010.01913.54
5.4.30.0040.01913.56
5.4.20.0030.01513.58
5.4.10.0050.01613.56
5.4.00.0050.01613.41
5.3.290.0030.03113.01
5.3.280.0060.02812.96
5.3.270.0060.02913.01
5.3.260.0090.02513.03
5.3.250.0050.03212.91
5.3.240.0010.02412.87
5.3.230.0070.02912.90
5.3.220.0040.03012.81
5.3.210.0020.03012.84
5.3.200.0060.02612.92
5.3.190.0060.01412.87
5.3.180.0020.01712.98
5.3.170.0010.02012.97
5.3.160.0040.01913.01
5.3.150.0030.01612.93
5.3.140.0020.01912.99
5.3.130.0000.02112.83
5.3.120.0070.01212.78
5.3.110.0040.01812.89
5.3.100.0010.02012.75
5.3.90.0070.01412.78
5.3.80.0040.01412.72
5.3.70.0040.02112.63
5.3.60.0060.02212.69
5.3.50.0040.01912.66
5.3.40.0040.02912.76
5.3.30.0040.01612.75
5.3.20.0070.01312.66
5.3.10.0030.01512.55
5.3.00.0050.02012.39
5.2.170.0070.05311.29
5.2.160.0000.03011.32
5.2.150.0030.02711.24
5.2.140.0070.03711.21
5.2.130.0130.01711.32
5.2.120.0030.02711.24
5.2.110.0030.03011.25
5.2.100.0000.03011.25
5.2.90.0000.03311.20
5.2.80.0030.02711.27
5.2.70.0030.02711.29
5.2.60.0030.03011.22
5.2.50.0070.02311.24
5.2.40.0030.03011.21
5.2.30.0000.03011.16
5.2.20.0000.04311.15
5.2.10.0070.02011.01
5.2.00.0000.03010.89
5.1.60.0000.02710.19
5.1.50.0030.03310.07
5.1.40.0030.02310.14
5.1.30.0070.02010.52
5.1.20.0070.02310.57
5.1.10.0000.05310.15
5.1.00.0030.05310.06
5.0.50.0000.0238.55
5.0.40.0000.0238.61
5.0.30.0030.0278.50
5.0.20.0000.0208.48
5.0.10.0000.0378.16
5.0.00.0030.0278.15
4.4.90.0030.0137.44
4.4.80.0030.0137.44
4.4.70.0000.0137.44
4.4.60.0000.0137.44
4.4.50.0000.0277.44
4.4.40.0000.0237.44
4.4.30.0000.0177.44
4.4.20.0000.0177.44
4.4.10.0000.0177.44
4.4.00.0030.0207.44
4.3.110.0070.0107.44
4.3.100.0030.0177.44
4.3.90.0000.0177.44
4.3.80.0030.0207.44
4.3.70.0000.0177.44
4.3.60.0000.0237.44
4.3.50.0030.0177.44
4.3.40.0000.0237.44
4.3.30.0000.0177.44
4.3.20.0070.0107.44
4.3.10.0000.0137.44
4.3.00.0030.0137.44

preferences:
39.91 ms | 401 KiB | 5 Q