3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test extends ArrayIterator { public function __toString() { /*if (count($this) > 1) { return (string) $this[0]; }*/ 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->xml->$offset); } public function offsetGet($offset) { if ($this->xml->getName() == $offset) { return $this; } return new Test((array)$this->xml->$offset); } 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.60.0090.00618.55
8.3.50.0130.00522.24
8.3.40.0070.00719.09
8.3.30.0040.01119.09
8.3.20.0040.00418.95
8.3.10.0040.00421.42
8.3.00.0070.00023.96
8.2.180.0040.01117.13
8.2.170.0090.00622.96
8.2.160.0070.00720.55
8.2.150.0080.00024.18
8.2.140.0080.00824.66
8.2.130.0040.00426.16
8.2.120.0030.00519.79
8.2.110.0040.00420.72
8.2.100.0040.00817.72
8.2.90.0030.00619.42
8.2.80.0080.00018.05
8.2.70.0040.00417.88
8.2.60.0030.00518.05
8.2.50.0050.00318.07
8.2.40.0000.00918.41
8.2.30.0000.00821.31
8.2.20.0000.00717.84
8.2.10.0070.00017.99
8.2.00.0080.00317.83
8.1.280.0070.00725.92
8.1.270.0000.00823.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0000.01024.17
8.1.230.0040.00720.98
8.1.220.0030.00618.77
8.1.210.0040.00419.09
8.1.200.0030.00617.47
8.1.190.0000.00817.64
8.1.180.0040.00418.10
8.1.170.0040.00418.90
8.1.160.0000.00719.13
8.1.150.0000.00818.82
8.1.140.0060.00317.69
8.1.130.0030.00317.95
8.1.120.0000.01117.77
8.1.110.0040.00417.65
8.1.100.0040.00417.65
8.1.90.0050.00317.64
8.1.80.0000.00817.68
8.1.70.0070.00017.58
8.1.60.0050.00317.68
8.1.50.0000.00817.73
8.1.40.0000.00817.75
8.1.30.0030.00517.81
8.1.20.0000.00817.89
8.1.10.0050.00217.71
8.1.00.0030.00517.73
8.0.300.0030.00820.20
8.0.290.0070.00017.30
8.0.280.0070.00018.57
8.0.270.0030.00317.38
8.0.260.0070.00017.04
8.0.250.0050.00317.16
8.0.240.0000.00817.18
8.0.230.0000.00717.23
8.0.220.0070.00017.15
8.0.210.0090.00017.12
8.0.200.0040.00417.06
8.0.190.0040.00417.13
8.0.180.0040.00417.01
8.0.170.0030.00617.05
8.0.160.0000.00717.05
8.0.150.0040.00417.14
8.0.140.0070.00017.15
8.0.130.0070.00013.62
8.0.120.0000.00717.20
8.0.110.0040.00417.00
8.0.100.0040.00416.92
8.0.90.0040.00417.08
8.0.80.0040.01117.14
8.0.70.0040.00416.98
8.0.60.0000.00717.15
8.0.50.0000.00816.97
8.0.30.0120.00817.43
8.0.20.0080.01117.46
8.0.10.0040.00417.14
8.0.00.0120.01017.06
7.4.330.0000.00514.80
7.4.320.0000.00616.77
7.4.300.0000.00616.76
7.4.290.0000.00716.74
7.4.280.0070.00016.75
7.4.270.0030.00316.82
7.4.260.0000.00513.47
7.4.250.0040.00416.72
7.4.240.0030.00316.75
7.4.230.0000.00716.67
7.4.220.0120.01216.71
7.4.210.0070.00816.78
7.4.200.0070.00016.93
7.4.190.0030.00316.56
7.4.160.0130.00316.66
7.4.150.0090.00917.40
7.4.140.0140.00717.86
7.4.130.0090.00816.77
7.4.120.0130.00416.71
7.4.110.0110.00716.71
7.4.100.0090.01316.85
7.4.90.0100.01116.79
7.4.80.0090.00919.37
7.4.70.0070.01016.73
7.4.60.0060.00916.63
7.4.50.0060.00316.66
7.4.40.0120.00622.52
7.4.30.0110.01316.62
7.4.10.0040.01215.01
7.4.00.0060.01115.16
7.3.330.0000.00513.44
7.3.320.0000.00613.41
7.3.310.0000.00716.40
7.3.300.0040.00416.44
7.3.290.0080.00816.53
7.3.280.0060.01116.56
7.3.270.0160.00317.40
7.3.260.0120.01018.24
7.3.250.0080.00916.59
7.3.240.0090.01516.80
7.3.230.0100.00716.57
7.3.210.0100.01316.77
7.3.200.0130.00619.39
7.3.190.0100.01016.80
7.3.180.0100.01316.65
7.3.170.0070.01616.76
7.3.160.0090.00916.79
7.3.130.0090.00915.16
7.3.120.0060.01015.03
7.3.110.0030.01414.88
7.3.100.0080.00515.01
7.3.90.0060.00914.80
7.3.80.0030.00915.10
7.3.70.0080.00415.10
7.3.60.0110.00414.94
7.3.50.0100.00614.99
7.3.40.0030.01014.95
7.3.30.0000.01814.83
7.3.20.0110.00016.70
7.3.10.0070.00717.05
7.3.00.0090.00616.58
7.2.330.0100.00717.06
7.2.320.0170.00716.96
7.2.310.0150.00316.99
7.2.300.0140.00416.63
7.2.290.0090.01217.09
7.2.260.0070.01115.19
7.2.250.0050.00815.26
7.2.240.0070.01114.84
7.2.230.0030.01215.28
7.2.220.0080.00615.20
7.2.210.0060.00615.36
7.2.200.0070.01115.00
7.2.190.0070.00715.25
7.2.180.0100.00315.43
7.2.170.0070.00715.37
7.2.160.0110.00414.88
7.2.150.0030.00917.27
7.2.140.0030.01417.08
7.2.130.0080.01116.98
7.2.120.0070.00717.07
7.2.110.0060.01217.01
7.2.100.0120.00316.69
7.2.90.0000.00916.91
7.2.80.0070.00716.91
7.2.70.0100.00017.17
7.2.60.0000.01417.21
7.2.50.0040.01116.87
7.2.40.0070.00317.12
7.2.30.0070.01017.06
7.2.20.0030.00917.05
7.2.10.0050.00517.03
7.2.00.0030.00917.04
7.1.330.0070.00716.01
7.1.320.0100.00715.88
7.1.310.0070.00716.05
7.1.300.0060.00915.86
7.1.290.0080.00415.83
7.1.280.0080.00815.64
7.1.270.0140.00015.78
7.1.260.0040.00816.08
7.1.250.0060.00615.85
7.1.240.0070.00715.91
7.1.230.0070.00716.05
7.1.220.0000.01315.78
7.1.210.0000.00916.10
7.1.200.0000.01315.92
7.1.190.0070.00715.98
7.1.180.0030.00915.95
7.1.170.0000.01115.79
7.1.160.0070.00716.00
7.1.150.0060.00315.81
7.1.140.0070.00315.88
7.1.130.0030.01215.93
7.1.120.0060.00915.95
7.1.110.0100.00615.84
7.1.100.0070.00617.10
7.1.90.0070.00715.95
7.1.80.0030.01015.83
7.1.70.0030.00816.43
7.1.60.0070.01217.62
7.1.50.0080.00816.40
7.1.40.0030.00716.04
7.1.30.0000.00915.90
7.1.20.0030.00615.95
7.1.10.0070.00415.84
7.1.00.0030.04119.09
7.0.330.0040.01415.62
7.0.320.0100.00315.53
7.0.310.0080.00015.63
7.0.300.0000.01415.21
7.0.290.0030.01015.29
7.0.280.0040.00415.61
7.0.270.0000.01015.54
7.0.260.0040.00715.50
7.0.250.0000.00915.32
7.0.240.0030.01015.59
7.0.230.0030.00715.34
7.0.220.0080.00815.38
7.0.210.0070.00715.57
7.0.200.0050.00616.04
7.0.190.0090.00315.54
7.0.180.0100.00315.59
7.0.170.0030.01215.61
7.0.160.0040.01115.70
7.0.150.0070.00715.59
7.0.140.0110.03618.69
7.0.130.0000.01415.54
7.0.120.0000.01715.16
7.0.110.0000.01615.42
7.0.100.0150.04817.76
7.0.90.0080.04517.77
7.0.80.0140.03817.69
7.0.70.0070.02017.80
7.0.60.0090.04717.78
7.0.50.0230.04217.89
7.0.40.0090.02916.76
7.0.30.0140.03716.91
7.0.20.0030.03016.79
7.0.10.0050.03016.88
7.0.00.0050.02716.97
5.6.400.0070.00714.37
5.6.390.0000.01614.46
5.6.380.0000.01114.54
5.6.370.0070.01014.62
5.6.360.0030.00614.59
5.6.350.0070.00714.67
5.6.340.0120.00014.67
5.6.330.0070.00714.31
5.6.320.0030.00614.43
5.6.310.0030.01114.70
5.6.300.0040.01114.41
5.6.290.0090.00614.55
5.6.280.0080.03517.72
5.6.270.0060.00914.59
5.6.260.0040.01114.63
5.6.250.0070.03317.65
5.6.240.0030.04917.60
5.6.230.0040.02617.61
5.6.220.0050.04517.51
5.6.210.0110.03817.64
5.6.200.0060.04617.87
5.6.190.0150.02817.74
5.6.180.0080.04317.89
5.6.170.0050.02717.84
5.6.160.0090.03717.73
5.6.150.0050.03517.95
5.6.140.0130.03817.81
5.6.130.0090.04217.86
5.6.120.0050.04917.79
5.6.110.0100.02317.77
5.6.100.0130.03817.69
5.6.90.0080.03717.96
5.6.80.0090.02717.62
5.6.70.0090.04217.45
5.6.60.0060.03917.30
5.6.50.0060.04017.59
5.6.40.0020.04817.58
5.6.30.0050.03617.54
5.6.20.0050.04417.54
5.6.10.0050.04017.54
5.6.00.0080.02717.53
5.5.380.0060.04817.49
5.5.370.0130.03817.41
5.5.360.0070.02617.65
5.5.350.0100.04217.61
5.5.340.0090.04117.58
5.5.330.0030.03517.62
5.5.320.0030.04217.75
5.5.310.0050.04217.69
5.5.300.0080.03317.64
5.5.290.0050.04817.79
5.5.280.0070.03417.61
5.5.270.0080.04617.72
5.5.260.0160.03817.67
5.5.250.0070.02717.67
5.5.240.0060.04417.26
5.5.230.0080.04117.29
5.5.220.0110.02517.38
5.5.210.0050.04717.48
5.5.200.0150.03717.42
5.5.190.0110.02317.46
5.5.180.0070.04017.43
5.5.170.0030.01314.38
5.5.160.0080.03717.23
5.5.150.0060.04417.41
5.5.140.0140.03317.28
5.5.130.0050.04517.32
5.5.120.0050.04117.39
5.5.110.0070.04517.39
5.5.100.0080.05017.33
5.5.90.0050.04517.32
5.5.80.0070.03217.17
5.5.70.0080.04117.37
5.5.60.0050.04617.29
5.5.50.0100.04217.28
5.5.40.0030.04617.36
5.5.30.0080.02617.18
5.5.20.0050.04517.00
5.5.10.0080.03217.23
5.5.00.0020.05017.27
5.4.450.0070.02815.53
5.4.440.0050.04215.54
5.4.430.0070.04415.50
5.4.420.0030.04215.41
5.4.410.0020.03515.39
5.4.400.0030.04515.28
5.4.390.0020.04015.21
5.4.380.0030.04215.07
5.4.370.0030.04214.98
5.4.360.0060.04315.31
5.4.350.0100.03215.13
5.4.340.0080.04115.22
5.4.330.0040.00811.37
5.4.320.0090.03215.15
5.4.310.0020.04315.09
5.4.300.0030.03315.31
5.4.290.0050.02515.18
5.4.280.0040.03515.09
5.4.270.0080.03915.32
5.4.260.0090.03715.26
5.4.250.0080.03315.30
5.4.240.0060.03815.20
5.4.230.0080.02515.12
5.4.220.0050.04315.18
5.4.210.0080.03815.09
5.4.200.0060.03615.19
5.4.190.0080.04115.22
5.4.180.0050.04015.20
5.4.170.0070.03815.22
5.4.160.0030.04315.18
5.4.150.0100.03815.33
5.4.140.0080.02713.89
5.4.130.0070.03813.84
5.4.120.0060.04013.92
5.4.110.0070.04014.00
5.4.100.0100.03713.99
5.4.90.0030.04114.06
5.4.80.0030.04213.79
5.4.70.0070.03913.87
5.4.60.0130.03013.93
5.4.50.0080.02613.83
5.4.40.0070.03313.79
5.4.30.0030.02913.94
5.4.20.0060.03513.92
5.4.10.0050.04213.93
5.4.00.0020.03113.43
5.3.290.0070.03912.79
5.3.280.0060.03512.91
5.3.270.0070.03412.80
5.3.260.0030.03012.82
5.3.250.0070.02212.85
5.3.240.0050.04012.84
5.3.230.0180.02612.78
5.3.220.0030.03412.82
5.3.210.0050.04212.89
5.3.200.0030.04312.79
5.3.190.0090.03012.83
5.3.180.0080.03012.84
5.3.170.0020.04212.83
5.3.160.0050.02712.84
5.3.150.0050.03612.80
5.3.140.0050.04112.84
5.3.130.0050.04212.82
5.3.120.0030.03812.82
5.3.110.0040.02712.81
5.3.100.0060.03112.57
5.3.90.0070.04312.57
5.3.80.0030.02312.55
5.3.70.0030.04612.57
5.3.60.0080.03812.59
5.3.50.0030.03912.57
5.3.40.0090.03712.57
5.3.30.0060.03812.50
5.3.20.0050.03812.36
5.3.10.0030.02512.29
5.3.00.0040.02512.36
5.2.170.0000.04011.97
5.2.160.0000.06711.97
5.2.150.0030.03711.97
5.2.140.0030.06711.97
5.2.130.0000.06711.97
5.2.120.0100.05011.97
5.2.110.0030.06311.97
5.2.100.0070.05711.97
5.2.90.0030.06311.97
5.2.80.0000.06711.97
5.2.70.0070.03711.97
5.2.60.0000.05711.97
5.2.50.0100.02711.97
5.2.40.0100.05711.97
5.2.30.0000.07311.97
5.2.20.0030.04311.97
5.2.10.0030.04311.97
5.2.00.0130.04011.97
5.1.60.0000.03711.97
5.1.50.0000.04311.97
5.1.40.0030.04711.97
5.1.30.0000.04011.97
5.1.20.0030.03711.97
5.1.10.0100.04711.97
5.1.00.0000.06011.97
5.0.50.0030.04311.97
5.0.40.0030.04311.97
5.0.30.0070.06011.97
5.0.20.0030.04311.97
5.0.10.0030.03711.97
5.0.00.0030.03311.97
4.4.90.0070.03011.97
4.4.80.0030.02011.97
4.4.70.0000.04011.97
4.4.60.0030.03711.97
4.4.50.0030.02711.97
4.4.40.0070.05011.97
4.4.30.0000.03711.97
4.4.20.0030.03711.97
4.4.10.0100.02711.97
4.4.00.0030.05011.97
4.3.110.0000.03311.97
4.3.100.0000.02711.97
4.3.90.0000.03711.97
4.3.80.0100.04711.97
4.3.70.0000.03311.97
4.3.60.0000.03311.97
4.3.50.0000.03711.97
4.3.40.0030.04711.97
4.3.30.0000.04011.97
4.3.20.0000.03311.97
4.3.10.0030.03311.97
4.3.00.0000.03011.97

preferences:
52.94 ms | 401 KiB | 5 Q