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($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.0090.00619.11
8.3.30.0040.01119.16
8.3.20.0050.00320.46
8.3.10.0080.00023.91
8.3.00.0080.00020.88
8.2.170.0100.00722.96
8.2.160.0140.00022.11
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00421.19
8.2.110.0040.00422.43
8.2.100.0090.00318.03
8.2.90.0060.00319.34
8.2.80.0000.00818.16
8.2.70.0000.00917.75
8.2.60.0110.00018.15
8.2.50.0040.00418.07
8.2.40.0040.00418.34
8.2.30.0040.00418.18
8.2.20.0000.00717.79
8.2.10.0080.00018.01
8.2.00.0090.00018.00
8.1.270.0080.00022.26
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00624.04
8.1.230.0080.00419.26
8.1.220.0000.00817.91
8.1.210.0080.00018.77
8.1.200.0060.00317.48
8.1.190.0060.00317.66
8.1.180.0000.00818.10
8.1.170.0030.00518.89
8.1.160.0000.00722.18
8.1.150.0050.00218.87
8.1.140.0080.00017.74
8.1.130.0000.00717.95
8.1.120.0030.00517.52
8.1.110.0040.00417.72
8.1.100.0000.00717.60
8.1.90.0000.00717.70
8.1.80.0070.00017.73
8.1.70.0030.00317.71
8.1.60.0040.00417.81
8.1.50.0050.00317.78
8.1.40.0000.00817.80
8.1.30.0030.00517.70
8.1.20.0030.00617.72
8.1.10.0000.00717.82
8.1.00.0060.00317.67
8.0.300.0000.00718.77
8.0.290.0040.00417.55
8.0.280.0040.00418.57
8.0.270.0030.00317.55
8.0.260.0000.00716.93
8.0.250.0000.00717.27
8.0.240.0040.00417.18
8.0.230.0070.00017.05
8.0.220.0000.00817.01
8.0.210.0040.00417.10
8.0.200.0080.00017.07
8.0.190.0040.00417.13
8.0.180.0000.00817.00
8.0.170.0000.00817.00
8.0.160.0000.00817.04
8.0.150.0000.00717.02
8.0.140.0000.00716.98
8.0.130.0060.00013.51
8.0.120.0040.00417.11
8.0.110.0040.00417.07
8.0.100.0070.00017.12
8.0.90.0070.00017.23
8.0.80.0140.00417.10
8.0.70.0000.00817.11
8.0.60.0080.00016.87
8.0.50.0000.00717.14
8.0.30.0020.01817.28
8.0.20.0160.00417.40
8.0.10.0070.00017.04
8.0.00.0110.00817.12
7.4.330.0000.00515.26
7.4.320.0000.00616.81
7.4.300.0000.00616.73
7.4.290.0050.00216.71
7.4.280.0030.00316.73
7.4.270.0000.00816.75
7.4.260.0030.00316.71
7.4.250.0000.00816.87
7.4.240.0030.00416.72
7.4.230.0030.00316.57
7.4.220.0150.00416.80
7.4.210.0110.00316.80
7.4.200.0030.00316.65
7.4.190.0070.00016.68
7.4.160.0090.00616.92
7.4.150.0060.01217.40
7.4.140.0140.00517.86
7.4.130.0090.01116.70
7.4.120.0130.00916.77
7.4.110.0100.00716.66
7.4.100.0080.00816.75
7.4.90.0140.00416.78
7.4.80.0190.00416.64
7.4.70.0050.01116.63
7.4.60.0070.01116.59
7.4.50.0000.00516.59
7.4.40.0000.01822.77
7.4.30.0000.01716.72
7.4.00.0030.01015.06
7.3.330.0000.00513.45
7.3.320.0050.00013.35
7.3.310.0040.00416.58
7.3.300.0000.00716.35
7.3.290.0130.00616.48
7.3.280.0090.00916.57
7.3.270.0100.00617.40
7.3.260.0080.01216.50
7.3.250.0130.00816.67
7.3.240.0050.01116.65
7.3.230.0130.00316.60
7.3.210.0370.02516.73
7.3.200.0100.01319.39
7.3.190.0140.00316.69
7.3.180.0090.00816.61
7.3.170.0130.00316.59
7.3.160.0090.00616.57
7.3.120.0070.00714.94
7.2.330.0060.01216.72
7.2.320.0120.00616.66
7.2.310.0080.00817.01
7.2.300.0100.00716.82
7.2.290.0110.00717.04
7.2.00.0090.00619.34
7.1.100.0040.00817.83
7.1.70.0090.00017.00
7.1.60.0030.02019.32
7.1.50.0060.01017.10
7.1.00.0100.07022.50
7.0.200.0100.00016.59
7.0.140.0070.06322.18
7.0.100.0100.07720.10
7.0.90.0100.07020.04
7.0.80.0070.08019.96
7.0.70.0130.07020.18
7.0.60.0170.06720.03
7.0.50.0100.07720.40
7.0.40.0070.08020.19
7.0.30.0130.08320.11
7.0.20.0200.06720.26
7.0.10.0070.07320.15
7.0.00.0070.08720.07
5.6.280.0070.07021.04
5.6.250.0030.07320.73
5.6.240.0100.08020.65
5.6.230.0000.08320.85
5.6.220.0030.05020.76
5.6.210.0130.07320.72
5.6.200.0030.08721.26
5.6.190.0070.08721.01
5.6.180.0170.07021.11
5.6.170.0130.08021.02
5.6.160.0000.08721.15
5.6.150.0130.08021.24
5.6.140.0100.08321.14
5.6.130.0130.08321.25
5.6.120.0170.07321.22
5.6.110.0100.08020.98
5.6.100.0070.05021.11
5.6.90.0130.04721.14
5.6.80.0070.06320.57
5.6.70.0100.07020.50
5.6.60.0030.08720.55
5.6.50.0070.07720.63
5.6.40.0100.07320.42
5.6.30.0070.05720.36
5.6.20.0130.07320.63
5.6.10.0030.08020.48
5.6.00.0130.07320.36
5.5.380.0100.06720.45
5.5.370.0100.06020.48
5.5.360.0130.07720.59
5.5.350.0070.05720.51
5.5.340.0130.07021.04
5.5.330.0130.08020.88
5.5.320.0100.07721.03
5.5.310.0070.08320.87
5.5.300.0130.07320.77
5.5.290.0100.07720.79
5.5.280.0170.07321.04
5.5.270.0030.05721.00
5.5.260.0100.07320.88
5.5.250.0030.08020.82
5.5.240.0170.06020.21
5.5.230.0170.07020.24
5.5.220.0100.07720.30
5.5.210.0130.07320.39
5.5.200.0100.07020.29
5.5.190.0030.08320.18
5.5.180.0170.07320.21
5.5.160.0200.07320.33
5.5.150.0100.06720.17
5.5.140.0130.07720.38
5.5.130.0030.05020.35
5.5.120.0100.07720.38
5.5.110.0170.04720.21
5.5.100.0030.07720.13
5.5.90.0070.08020.23
5.5.80.0100.07020.10
5.5.70.0070.05020.24
5.5.60.0100.07320.11
5.5.50.0170.06320.11
5.5.40.0030.07020.21
5.5.30.0170.06020.20
5.5.20.0100.07720.02
5.5.10.0030.06020.09
5.5.00.0000.04720.21
5.4.450.0100.08019.43
5.4.440.0070.07319.57
5.4.430.0200.06719.54
5.4.420.0070.07319.54
5.4.410.0070.07719.40
5.4.400.0070.06319.22
5.4.390.0000.08319.22
5.4.380.0070.07319.28
5.4.370.0070.07019.22
5.4.360.0070.07719.27
5.4.350.0030.07319.04
5.4.340.0100.07718.93
5.4.320.0100.07719.34
5.4.310.0000.07319.24
5.4.300.0030.08318.95
5.4.290.0070.06719.12
5.4.280.0230.06019.22
5.4.270.0000.08019.26
5.4.260.0000.05318.92
5.4.250.0070.08719.27
5.4.240.0130.06719.03
5.4.230.0170.06319.20
5.4.220.0200.06719.22
5.4.210.0100.06718.92
5.4.200.0070.07319.20
5.4.190.0070.07719.01
5.4.180.0170.06719.11
5.4.170.0030.04719.10
5.4.160.0070.03319.21
5.4.150.0030.03718.93
5.4.140.0070.03716.63
5.4.130.0000.04016.55
5.4.120.0030.08016.53
5.4.110.0030.03716.60
5.4.100.0000.04016.56
5.4.90.0000.04016.68
5.4.80.0000.06316.54
5.4.70.0030.07016.57
5.4.60.0030.03316.64
5.4.50.0070.07716.54
5.4.40.0130.04716.44
5.4.30.0100.06016.54
5.4.20.0000.05716.60
5.4.10.0000.06316.54
5.4.00.0130.06715.98
5.3.290.0100.07014.83
5.3.280.0100.07014.75
5.3.270.0130.03714.76
5.3.260.0070.03714.67
5.3.250.0100.03314.80
5.3.240.0000.04014.69
5.3.230.0070.03314.68
5.3.220.0070.03314.57
5.3.210.0030.03714.63
5.3.200.0130.06314.79
5.3.190.0000.05714.77
5.3.180.0100.02714.71
5.3.170.0070.07314.63
5.3.160.0100.06714.60
5.3.150.0070.07714.77
5.3.140.0030.07714.63
5.3.130.0130.06314.64
5.3.120.0030.05314.70
5.3.110.0030.05014.58
5.3.100.0000.04014.24
5.3.90.0000.04014.11
5.3.80.0030.04014.11
5.3.70.0030.06314.03
5.3.60.0100.05014.24
5.3.50.0030.03314.16
5.3.40.0030.03314.11
5.3.30.0000.03714.16
5.3.20.0070.03313.83
5.3.10.0030.03313.80
5.3.00.0030.03713.89
5.2.170.0030.05011.15
5.2.160.0000.03311.12
5.2.150.0030.02711.28
5.2.140.0000.03011.22
5.2.130.0000.03011.25
5.2.120.0000.05711.35
5.2.110.0000.03011.35
5.2.100.0000.03311.25
5.2.90.0030.04711.36
5.2.80.0000.03311.24
5.2.70.0000.03311.17
5.2.60.0070.02311.04
5.2.50.0130.01711.22
5.2.40.0030.03010.98
5.2.30.0000.03710.95
5.2.20.0030.04311.03
5.2.10.0030.02711.05
5.2.00.0030.03010.73
5.1.60.0030.02310.23
5.1.50.0070.0339.99
5.1.40.0000.02710.13
5.1.30.0000.02710.49
5.1.20.0000.02710.36
5.1.10.0000.02310.13
5.1.00.0070.02310.31
5.0.50.0030.0309.98
5.0.40.0000.0209.98
5.0.30.0070.0279.98
5.0.20.0000.0209.98
5.0.10.0030.0179.98
5.0.00.0000.0309.98
4.4.90.0070.0209.98
4.4.80.0030.0139.98
4.4.70.0000.0209.98
4.4.60.0030.0139.98
4.4.50.0000.0179.98
4.4.40.0000.0279.98
4.4.30.0000.0179.98
4.4.20.0030.0139.98
4.4.10.0030.0139.98
4.4.00.0000.0379.98
4.3.110.0000.0139.98
4.3.100.0070.0109.98
4.3.90.0000.0209.98
4.3.80.0030.0279.98
4.3.70.0000.0239.98
4.3.60.0000.0139.98
4.3.50.0000.0239.98
4.3.40.0030.0379.98
4.3.30.0000.0239.98
4.3.20.0000.0139.98
4.3.10.0070.0209.98
4.3.00.0000.0339.98

preferences:
59.22 ms | 400 KiB | 5 Q