3v4l.org

run code in 300+ PHP versions simultaneously
<?php class RenderHelper extends ArrayIterator { public function __toString() { return (string) $this[0]; } } 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->offsetGet($offset)); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } return new RenderHelper((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; } } $xml = '<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading foo="bar">Reminder</heading> <body>Don\'t forget me this weekend!</body> <recursive> <val>2</val> <val>4</val> </recursive> </note>'; $xml = new XmlArrayAccessIterator($xml, false); echo $xml['note']['to'][0]; 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.0100.00616.88
8.3.50.0080.00822.20
8.3.40.0070.00719.05
8.3.30.0070.00719.32
8.3.20.0100.00020.45
8.3.10.0080.00023.86
8.3.00.0090.00021.20
8.2.180.0100.00718.81
8.2.170.0090.00922.96
8.2.160.0070.00720.64
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00420.64
8.2.110.0040.00422.45
8.2.100.0040.00718.22
8.2.90.0000.00819.46
8.2.80.0000.00817.97
8.2.70.0050.00517.88
8.2.60.0050.00518.18
8.2.50.0080.00018.07
8.2.40.0080.00020.07
8.2.30.0080.00018.54
8.2.20.0080.00017.94
8.2.10.0060.00318.37
8.2.00.0040.00417.86
8.1.280.0090.00625.92
8.1.270.0050.00324.08
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00024.04
8.1.230.0090.00319.27
8.1.220.0000.00918.04
8.1.210.0000.00818.77
8.1.200.0000.01017.61
8.1.190.0030.00617.48
8.1.180.0050.00319.26
8.1.170.0000.00818.74
8.1.160.0070.00022.24
8.1.150.0080.00018.86
8.1.140.0000.00817.62
8.1.130.0030.00318.06
8.1.120.0040.00417.58
8.1.110.0070.00017.70
8.1.100.0030.00317.58
8.1.90.0040.00417.65
8.1.80.0030.00517.73
8.1.70.0000.00717.69
8.1.60.0080.00017.81
8.1.50.0000.00917.77
8.1.40.0000.00817.64
8.1.30.0030.00817.74
8.1.20.0000.00917.79
8.1.10.0040.00417.73
8.1.00.0040.00417.63
8.0.300.0000.00818.77
8.0.290.0000.00817.18
8.0.280.0000.00718.67
8.0.270.0000.00717.48
8.0.260.0030.00317.48
8.0.250.0000.00717.05
8.0.240.0030.00317.12
8.0.230.0030.00517.08
8.0.220.0000.00717.14
8.0.210.0070.00017.09
8.0.200.0000.00617.02
8.0.190.0040.00417.15
8.0.180.0040.00417.09
8.0.170.0050.00217.25
8.0.160.0040.00417.26
8.0.150.0030.00517.02
8.0.140.0070.00017.13
8.0.130.0030.00313.61
8.0.120.0030.00517.00
8.0.110.0000.00717.14
8.0.100.0040.00416.95
8.0.90.0040.00417.18
8.0.80.0130.00317.21
8.0.70.0000.00716.98
8.0.60.0080.00017.22
8.0.50.0030.00617.01
8.0.30.0140.00817.47
8.0.20.0090.01017.46
8.0.10.0040.00417.16
8.0.00.0100.00816.94
7.4.330.0050.00015.20
7.4.320.0030.00316.77
7.4.300.0040.00416.75
7.4.290.0000.00716.62
7.4.280.0040.00416.81
7.4.270.0030.00316.76
7.4.260.0050.00216.72
7.4.250.0040.00416.89
7.4.240.0020.00516.88
7.4.230.0040.00416.51
7.4.220.0030.01416.68
7.4.210.0040.01016.79
7.4.200.0050.00216.85
7.4.190.0000.00716.72
7.4.160.0160.00716.83
7.4.150.0100.00717.40
7.4.140.0070.01517.86
7.4.130.0120.00616.63
7.4.120.0070.01016.78
7.4.110.0130.00316.64
7.4.100.0110.00716.73
7.4.90.0130.00316.83
7.4.80.0170.00719.39
7.4.70.0030.01316.68
7.4.60.0070.01016.67
7.4.50.0040.00416.82
7.4.40.0090.00616.45
7.4.30.0100.01316.80
7.4.00.0090.00614.89
7.3.330.0000.00613.43
7.3.320.0000.00513.38
7.3.310.0070.00016.55
7.3.300.0030.00316.45
7.3.290.0110.01116.66
7.3.280.0110.00816.58
7.3.270.0120.00617.40
7.3.260.0170.00016.75
7.3.250.0060.01116.74
7.3.240.0070.01116.90
7.3.230.0100.00716.72
7.3.210.0070.01016.67
7.3.200.0070.01019.39
7.3.190.0140.00316.83
7.3.180.0060.01016.73
7.3.170.0100.00716.69
7.3.160.0060.00916.82
7.3.120.0040.01114.96
7.2.330.0030.01516.84
7.2.320.0110.01016.81
7.2.310.0180.00316.99
7.2.300.0030.01516.77
7.2.290.0090.00917.07
7.2.00.0030.01419.31
7.1.100.0050.00517.88
7.1.70.0030.01317.16
7.1.60.0040.02219.46
7.1.50.0130.01017.13
7.1.00.0070.07322.58
7.0.200.0000.00817.05
7.0.140.0070.07022.03
7.0.60.0130.06720.02
7.0.50.0170.07318.06
7.0.40.0100.05020.43
7.0.30.0330.05020.20
7.0.20.0230.08020.22
7.0.10.0370.08020.21
7.0.00.0170.08020.38
5.6.280.0000.07321.14
5.6.210.0070.08320.56
5.6.200.0100.08718.32
5.6.190.0100.07320.74
5.6.180.0300.07320.79
5.6.170.0200.05020.63
5.6.160.0100.05720.70
5.6.150.0100.06018.38
5.6.140.0000.05318.26
5.6.130.0100.08018.40
5.6.120.0000.08321.23
5.6.110.0070.07021.14
5.6.100.0030.08321.14
5.6.90.0030.08721.19
5.6.80.0070.04720.64
5.6.70.0130.03320.57
5.5.350.4230.04020.46
5.5.340.0030.07718.09
5.5.330.0000.05720.61
5.5.320.0070.06320.64
5.5.310.0330.07320.45
5.5.300.0030.05718.16
5.5.290.0000.04318.05
5.5.280.0170.06020.75
5.5.270.0030.08720.86
5.5.260.0100.07720.83
5.5.250.0130.07720.93
5.5.240.0030.06720.28
5.4.450.3770.04019.44
5.4.440.3900.04019.62
5.4.430.3670.03019.37
5.4.420.3770.04319.63
5.4.410.3770.04319.53
5.4.400.3900.03019.39
5.4.390.3730.03319.16
5.4.380.3500.04319.13
5.4.370.3630.02719.31
5.4.360.3630.03319.30
5.4.350.3700.03719.39
5.4.340.3600.04719.13
5.4.320.2730.03319.05
5.4.310.2630.03719.06
5.4.300.3400.04019.31
5.4.290.3100.03719.13
5.4.280.3670.03319.29
5.4.270.3600.03319.17
5.4.260.2970.04019.20
5.4.250.3530.04019.06
5.4.240.3900.03019.29
5.4.230.3570.03719.06
5.4.220.4130.04319.04
5.4.210.3770.03719.13
5.4.200.3400.03319.13
5.4.190.3900.03319.35
5.4.180.3930.03319.01
5.4.170.3570.03319.21
5.4.160.3600.04319.37
5.4.150.3630.03319.31
5.4.140.3530.03316.60
5.4.130.3330.03316.80
5.4.120.4000.03316.50
5.4.110.3570.03316.53
5.4.100.3700.03716.49
5.4.90.3730.03716.49
5.4.80.3100.03016.67
5.4.70.4000.03016.71
5.4.60.3430.03316.66
5.4.50.3970.04016.55
5.4.40.4070.04016.50
5.4.30.3530.03716.63
5.4.20.3630.03016.68
5.4.10.3830.03716.48
5.4.00.3800.04016.09
5.3.290.3370.03714.94
5.3.280.3800.03314.79
5.3.270.3670.03714.72
5.3.260.3730.03314.68
5.3.250.3570.03314.89
5.3.240.3900.03714.93
5.3.230.3400.03714.72
5.3.220.3600.03314.89
5.3.210.3970.03714.62
5.3.200.3600.03014.68
5.3.190.3830.03714.65
5.3.180.3970.03314.83
5.3.170.3900.03314.68
5.3.160.3970.03714.80
5.3.150.3700.04714.68
5.3.140.3730.03714.66
5.3.130.3800.04014.78
5.3.120.3870.03714.73
5.3.110.3870.04014.68
5.3.100.3770.03014.10
5.3.90.3530.04014.20
5.3.80.3670.03014.08
5.3.70.3630.03014.20
5.3.60.3630.03314.18
5.3.50.3570.03714.17
5.3.40.3830.03714.14
5.3.30.3600.04014.04
5.3.20.3530.03713.78
5.3.10.3230.03313.73
5.3.00.4000.03013.66
5.2.170.3270.02711.38
5.2.160.3270.02711.20
5.2.150.3000.03711.41
5.2.140.3270.02311.18
5.2.130.3230.03711.19
5.2.120.2870.02011.12
5.2.110.2700.05311.28
5.2.100.3000.03011.16
5.2.90.3130.02711.43
5.2.80.3100.02711.43
5.2.70.3470.02311.15
5.2.60.3200.03011.32
5.2.50.3230.03311.23
5.2.40.2470.02711.25
5.2.30.2870.03311.15
5.2.20.2670.03311.09
5.2.10.2930.03310.93
5.2.00.3230.03010.89
5.1.60.2830.02310.18
5.1.50.2670.02710.27
5.1.40.2730.03010.24
5.1.30.2700.02710.51
5.1.20.2770.01710.38
5.1.10.2430.03310.11
5.1.00.2630.02710.02
5.0.50.1500.0209.89
5.0.40.1270.0179.89
5.0.30.1330.0309.89
5.0.20.1530.0209.89
5.0.10.1430.0179.89
5.0.00.1700.0379.89
4.4.90.1630.0239.89
4.4.80.1300.0139.89
4.4.70.0970.0239.89
4.4.60.1530.0209.89
4.4.50.1430.0179.89
4.4.40.1230.0209.89
4.4.30.1300.0179.89
4.4.20.1430.0179.89
4.4.10.1370.0209.89
4.4.00.1300.0279.89
4.3.110.1200.0179.89
4.3.100.1170.0179.89
4.3.90.1470.0179.89
4.3.80.1800.0279.89
4.3.70.1430.0179.89
4.3.60.1300.0139.89
4.3.50.1670.0179.89
4.3.40.1430.0239.89
4.3.30.0600.0139.89
4.3.20.0600.0179.89
4.3.10.0600.0179.89
4.3.00.0800.0239.89

preferences:
40.63 ms | 401 KiB | 5 Q