3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyXML extends SimpleXMLElement { public function firstChild() { $children = $this->children(); foreach ($children as $child) break; return $child; } public function keyHasTwins($key) { if (isset($this->$key)) return (count($this->$key)>1); else return false; } public function hasChildren() { return (bool)count($this->children()); } } $s = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'. '<request>'. ' <body>'. ' <rows>'. ' <row id="1"/>'. ' <row id="2"/>'. ' <row id="3"/>'. ' <row2 ver="2.0">test data</row2>'. ' <row2 ver="2.1">test data 2</row2>'. ' <row3 ver="3.0">'. ' <test inherit="yes">data</test>'. ' </row3>'. ' </rows>'. ' </body>'. '</request>'; $obj = new MyXML($s); $rows = $obj->firstChild()->firstChild()->row2; var_dump(count($rows), $rows->hasChildren());

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.40.0070.00718.93
8.3.30.0040.01118.95
8.3.20.0050.00319.02
8.3.10.0060.00320.77
8.3.00.0090.00619.50
8.2.170.0110.00422.96
8.2.160.0100.01019.54
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00319.01
8.2.110.0040.00819.47
8.2.100.0060.00617.97
8.2.90.0060.00319.59
8.2.80.0050.00219.53
8.2.70.0000.00817.63
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0050.00318.47
8.2.30.0090.00018.16
8.2.20.0050.00519.59
8.2.10.0040.00417.82
8.2.00.0070.00417.86
8.1.270.0060.00324.66
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0110.00022.32
8.1.230.0120.00023.00
8.1.220.0080.00018.04
8.1.210.0060.00319.23
8.1.200.0000.00917.61
8.1.190.0040.00417.53
8.1.180.0040.00418.10
8.1.170.0030.00519.15
8.1.160.0070.00019.10
8.1.150.0030.00618.86
8.1.140.0080.00017.57
8.1.130.0000.00718.04
8.1.120.0020.00517.59
8.1.110.0040.00417.76
8.1.100.0040.00417.70
8.1.90.0000.00717.73
8.1.80.0040.00417.64
8.1.70.0000.00717.70
8.1.60.0000.00917.84
8.1.50.0060.00317.60
8.1.40.0040.00417.82
8.1.30.0040.00417.75
8.1.20.0040.00417.80
8.1.10.0040.00417.79
8.1.00.0040.00417.77
8.0.300.0000.00820.16
8.0.290.0050.00217.00
8.0.280.0030.00318.71
8.0.270.0000.00717.38
8.0.260.0000.00716.99
8.0.250.0080.00017.09
8.0.240.0000.00717.11
8.0.230.0030.00317.19
8.0.220.0000.00817.14
8.0.210.0030.00317.18
8.0.200.0000.00717.20
8.0.190.0000.00817.25
8.0.180.0040.00417.13
8.0.170.0030.00617.01
8.0.160.0040.00416.94
8.0.150.0060.00316.92
8.0.140.0050.00516.97
8.0.130.0060.00013.56
8.0.120.0060.00317.12
8.0.110.0000.00717.16
8.0.100.0030.00517.21
8.0.90.0060.00317.04
8.0.80.0060.00917.16
8.0.70.0040.00417.13
8.0.60.0000.00717.00
8.0.50.0040.00417.21
8.0.30.0170.00817.20
8.0.20.0080.01117.18
8.0.10.0040.00417.09
8.0.00.0150.00916.98
7.4.330.0020.00213.25
7.4.320.0000.00616.71
7.4.300.0000.00616.69
7.4.290.0000.00716.71
7.4.280.0090.00016.65
7.4.270.0070.00016.79
7.4.260.0030.00313.61
7.4.250.0030.00716.73
7.4.240.0030.00316.66
7.4.230.0050.00316.62
7.4.220.0090.00916.88
7.4.210.0100.00616.79
7.4.200.0040.00416.52
7.4.190.0000.00716.71
7.4.160.0110.00616.70
7.4.150.0150.01016.71
7.4.140.0130.00316.56
7.4.130.0030.01316.84
7.4.120.0160.00016.70
7.4.110.0040.01416.78
7.4.100.0100.00616.74
7.4.90.0060.01316.66
7.4.80.0130.01016.84
7.4.70.0110.00716.83
7.4.60.0090.00616.54
7.4.50.0040.00416.45
7.4.40.0060.01016.61
7.4.30.0000.01616.81
7.4.00.0060.00915.14
7.3.330.0060.00013.54
7.3.320.0050.00313.32
7.3.310.0000.00716.34
7.3.300.0030.00316.50
7.3.290.0070.00816.54
7.3.280.0090.00816.52
7.3.270.0140.00416.84
7.3.260.0100.00716.49
7.3.250.0050.01516.67
7.3.240.0040.01416.54
7.3.230.0060.01016.59
7.3.210.0140.01016.47
7.3.200.0090.01219.39
7.3.190.0100.01316.63
7.3.180.0030.01316.41
7.3.170.0150.00416.56
7.3.160.0090.00616.77
7.3.120.0040.01214.79
7.3.10.0040.01116.89
7.3.00.0030.00616.77
7.2.330.0070.01116.70
7.2.320.0110.00716.77
7.2.310.0130.01017.07
7.2.300.0090.01216.70
7.2.290.0120.00617.06
7.2.130.0110.00316.95
7.2.120.0090.00417.12
7.2.110.0000.01017.16
7.2.100.0060.00317.00
7.2.90.0040.00417.02
7.2.80.0000.01216.98
7.2.70.0060.00617.01
7.2.60.0060.00916.91
7.2.50.0060.00317.11
7.2.40.0030.01317.09
7.2.30.0110.00417.36
7.2.20.0090.00916.80
7.2.10.0030.00617.13
7.2.00.0040.00918.25
7.1.250.0060.00615.86
7.1.100.0030.00918.30
7.1.70.0050.00817.39
7.1.60.0170.00719.31
7.1.50.0100.00717.13
7.1.00.0030.07322.52
7.0.200.0200.00716.65
7.0.140.0130.06322.13
7.0.60.0100.06319.89
7.0.50.0130.06317.94
7.0.40.0030.09320.18
7.0.30.0200.04720.34
7.0.20.0230.05020.19
7.0.10.0300.08320.26
7.0.00.0070.08720.31
5.6.280.0100.06721.19
5.6.210.0100.05720.59
5.6.200.0070.06018.30
5.6.190.0170.08320.85
5.6.180.0230.08320.52
5.6.170.0370.07720.64
5.6.160.0100.06320.64
5.6.150.0100.07718.36
5.6.140.0070.03718.36
5.6.130.0130.07718.35
5.6.120.0100.06021.05
5.6.110.0200.07021.05
5.6.100.0070.07321.04
5.6.90.0100.07721.17
5.6.80.0030.03720.61
5.6.70.0270.07020.56
5.5.350.0170.04320.55
5.5.340.0070.05018.12
5.5.330.0030.09320.21
5.5.320.0300.06320.61
5.5.310.0330.07020.43
5.5.300.0130.07018.06
5.5.290.0030.04018.15
5.5.280.0070.06320.94
5.5.270.0130.08020.77
5.5.260.0100.06021.07
5.5.250.0230.06320.71
5.5.240.0070.08020.11
5.4.450.0300.07019.72
5.4.440.0300.06319.63
5.4.430.0170.06719.46
5.4.420.0270.06719.62
5.4.410.0330.07719.59
5.4.400.0300.03319.37
5.4.390.0370.04319.06
5.4.380.0270.05319.30
5.4.370.0330.03319.32
5.4.360.0300.06719.16
5.4.350.0230.04019.32
5.4.340.0400.06719.21
5.4.320.0300.05319.34
5.4.310.0230.04719.23
5.4.300.0270.07019.14
5.4.290.0170.05719.13
5.4.280.0270.04019.30
5.4.270.0270.05719.39
5.4.260.0270.05719.22
5.4.250.0300.03319.36
5.4.240.0230.05719.05
5.4.230.0300.05319.31
5.4.220.0230.08019.32
5.4.210.0270.08019.16
5.4.200.0300.06719.31
5.4.190.0370.06019.13
5.4.180.0270.06719.38
5.4.170.0470.04719.13
5.4.160.0300.03019.31
5.4.150.0200.04019.15
5.4.140.0330.06316.63
5.4.130.0300.06316.62
5.4.120.0270.07316.55
5.4.110.0370.04016.54
5.4.100.0200.04016.58
5.4.90.0230.07716.59
5.4.80.0370.05316.67
5.4.70.0270.06716.68
5.4.60.0200.07316.64
5.4.50.0270.03316.65
5.4.40.0300.03016.51
5.4.30.0470.05016.37
5.4.20.0270.07016.65
5.4.10.0170.04716.48
5.4.00.0270.05715.91
5.3.290.0230.04714.88
5.3.280.0270.04714.84
5.3.270.0270.06014.82
5.3.260.0200.05314.87
5.3.250.0270.03714.77
5.3.240.0330.05014.72
5.3.230.0270.03314.84
5.3.220.0330.02714.61
5.3.210.0230.04314.67
5.3.200.0300.06714.84
5.3.190.0330.04714.78
5.3.180.0330.04314.81
5.3.170.0470.05314.62
5.3.160.0400.06314.87
5.3.150.0300.03714.61
5.3.140.0230.03714.77
5.3.130.0270.06314.79
5.3.120.0270.04314.71
5.3.110.0300.04014.61
5.3.100.0370.06014.20
5.3.90.0300.05314.33
5.3.80.0400.05714.01
5.3.70.0230.05014.08
5.3.60.0300.06014.31
5.3.50.0330.04013.96
5.3.40.0200.04014.05
5.3.30.0200.03714.00
5.3.20.0300.05313.89
5.3.10.0270.05313.67
5.3.00.0230.04013.73
5.2.170.0200.06012.44
5.2.160.0230.04312.44
5.2.150.0170.03312.44
5.2.140.0230.05712.44
5.2.130.0300.04712.44
5.2.120.0170.04012.44
5.2.110.0200.03312.44
5.2.100.0200.03312.44
5.2.90.0230.04012.44
5.2.80.0170.03012.44
5.2.70.0200.04312.44
5.2.60.0170.03012.44
5.2.50.0200.03012.44
5.2.40.0270.03312.44
5.2.30.0170.05012.44
5.2.20.0200.03312.44
5.2.10.0270.03312.44
5.2.00.0170.05312.44
5.1.60.0200.04312.44
5.1.50.0130.03712.44
5.1.40.0170.03312.44
5.1.30.0330.05712.44
5.1.20.0130.02712.44
5.1.10.0230.04312.44
5.1.00.0230.03312.44
5.0.50.0100.02012.44
5.0.40.0170.03012.44
5.0.30.0130.06012.44
5.0.20.0070.04012.44
5.0.10.0070.03012.44
5.0.00.0100.06312.44
4.4.90.0030.02012.44
4.4.80.0070.01712.44
4.4.70.0130.02012.44
4.4.60.0070.03012.44
4.4.50.0130.02012.44
4.4.40.0130.03312.44
4.4.30.0170.02312.44
4.4.20.0130.03012.44
4.4.10.0100.01712.44
4.4.00.0170.02312.44
4.3.110.0130.03312.44
4.3.100.0100.02312.44
4.3.90.0170.02712.44
4.3.80.0130.03012.44
4.3.70.0100.03712.44
4.3.60.0100.02312.44
4.3.50.0100.03012.44
4.3.40.0100.05012.44
4.3.30.0030.03312.44
4.3.20.0070.02012.44
4.3.10.0030.03712.44
4.3.00.0030.03312.44

preferences:
59.82 ms | 400 KiB | 5 Q