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() { var_dump(count($this->children())); 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>data</test>'. ' </row3>'. ' </rows>'. ' </body>'. '</request>'; $obj = new MyXML($s); $rows = $obj->firstChild()->firstChild()->children(); var_dump($rows->hasChildren('row')); var_dump($rows->hasChildren('row2')); var_dump($rows->hasChildren('row3'));

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.0130.00318.56
8.3.50.0110.00622.11
8.3.40.0080.00819.04
8.3.30.0110.00420.49
8.3.20.0090.00018.98
8.3.10.0100.01021.23
8.3.00.0060.01319.81
8.2.180.0100.01017.00
8.2.170.0090.00622.96
8.2.160.0070.00720.60
8.2.150.0040.01524.18
8.2.140.0030.00624.66
8.2.130.0120.00626.16
8.2.120.0080.00020.20
8.2.110.0060.00320.66
8.2.100.0080.00317.97
8.2.90.0040.00419.52
8.2.80.0050.00319.59
8.2.70.0000.00917.75
8.2.60.0000.00818.17
8.2.50.0000.00818.07
8.2.40.0040.00418.34
8.2.30.0000.00719.64
8.2.20.0030.00517.95
8.2.10.0040.00417.95
8.2.00.0030.00517.94
8.1.280.0110.00725.92
8.1.270.0060.00323.99
8.1.260.0030.00626.35
8.1.250.0150.00328.09
8.1.240.0090.00022.81
8.1.230.0060.00621.16
8.1.220.0000.00818.77
8.1.210.0110.00418.91
8.1.200.0030.00617.38
8.1.190.0000.00817.64
8.1.180.0030.00518.10
8.1.170.0040.00418.84
8.1.160.0000.01019.11
8.1.150.0080.00018.86
8.1.140.0070.00017.63
8.1.130.0000.00718.06
8.1.120.0050.00317.57
8.1.110.0000.00717.72
8.1.100.0070.00017.75
8.1.90.0050.00317.70
8.1.80.0000.00717.58
8.1.70.0050.00317.61
8.1.60.0030.00617.89
8.1.50.0040.00417.61
8.1.40.0000.00817.84
8.1.30.0000.00917.92
8.1.20.0040.00417.75
8.1.10.0000.00917.91
8.1.00.0030.00517.74
8.0.300.0000.00820.35
8.0.290.0040.00417.55
8.0.280.0000.00718.56
8.0.270.0040.00417.47
8.0.260.0040.00417.00
8.0.250.0040.00417.25
8.0.240.0000.01117.27
8.0.230.0000.00717.12
8.0.220.0030.00617.05
8.0.210.0040.00417.00
8.0.200.0070.00017.24
8.0.190.0040.00417.05
8.0.180.0040.00417.11
8.0.170.0030.00517.01
8.0.160.0040.00417.24
8.0.150.0050.00217.14
8.0.140.0040.00416.96
8.0.130.0070.00013.58
8.0.120.0040.00417.16
8.0.110.0040.00417.09
8.0.100.0000.00817.15
8.0.90.0030.00516.95
8.0.80.0090.00617.07
8.0.70.0000.00817.22
8.0.60.0000.00817.02
8.0.50.0000.00817.11
8.0.30.0090.00917.10
8.0.20.0050.01717.40
8.0.10.0050.00317.29
8.0.00.0120.00916.93
7.4.330.0050.00016.91
7.4.320.0070.00016.76
7.4.300.0080.00016.75
7.4.290.0000.00716.76
7.4.280.0000.00716.77
7.4.270.0040.00416.63
7.4.260.0000.00613.53
7.4.250.0050.00316.71
7.4.240.0040.00416.84
7.4.230.0030.00516.73
7.4.220.0060.01316.57
7.4.210.0060.01016.86
7.4.200.0070.00016.77
7.4.190.0000.00716.62
7.4.160.0080.00816.75
7.4.150.0110.00617.40
7.4.140.0110.00717.86
7.4.130.0100.01316.63
7.4.120.0130.00416.81
7.4.110.0060.01316.87
7.4.100.0120.00616.76
7.4.90.0130.00616.55
7.4.80.0000.01819.39
7.4.70.0110.00716.89
7.4.60.0090.00916.55
7.4.50.0040.00416.56
7.4.40.0020.01122.77
7.4.30.0130.00616.85
7.4.00.0100.00715.09
7.3.330.0030.00313.57
7.3.320.0060.00013.51
7.3.310.0030.00516.50
7.3.300.0070.00016.62
7.3.290.0060.00616.50
7.3.280.0100.00616.55
7.3.270.0060.01317.40
7.3.260.0120.00718.24
7.3.250.0100.00716.61
7.3.240.0100.00716.63
7.3.230.0120.00616.76
7.3.210.0060.01216.60
7.3.200.0100.01319.39
7.3.190.0120.00616.93
7.3.180.0110.01016.88
7.3.170.0060.01016.93
7.3.160.0190.00416.73
7.3.120.0070.01014.80
7.3.00.0060.00616.62
7.2.330.0100.00716.69
7.2.320.0070.01017.04
7.2.310.0170.00716.90
7.2.300.0100.00617.00
7.2.290.0060.01116.75
7.2.130.0030.01016.97
7.2.120.0090.00616.96
7.2.110.0070.00317.03
7.2.100.0060.00616.96
7.2.90.0030.00817.13
7.2.80.0080.00517.12
7.2.70.0040.00816.78
7.2.60.0060.00817.07
7.2.50.0030.01216.92
7.2.40.0050.00516.88
7.2.30.0030.01017.08
7.2.20.0070.00716.63
7.2.10.0060.00616.96
7.2.00.0030.00616.90
7.1.250.0040.00815.89
7.1.240.0000.00915.91
7.1.230.0030.00715.83
7.1.220.0030.00715.71
7.1.210.0100.00315.86
7.1.200.0070.00715.72
7.1.190.0030.00615.85
7.1.180.0060.00615.77
7.1.170.0030.00515.86
7.1.160.0110.00615.87
7.1.150.0040.00815.80
7.1.140.0080.00415.83
7.1.130.0070.00715.88
7.1.120.0040.00815.96
7.1.110.0030.00615.82
7.1.100.0000.01015.80
7.1.90.0100.00715.64
7.1.80.0070.00715.70
7.1.70.0090.00516.53
7.1.60.0060.00516.52
7.1.50.0020.00916.46
7.1.40.0040.00716.19
7.1.30.0080.00416.14
7.1.20.0070.00716.29
7.1.10.0020.00916.16
7.1.00.0020.00616.22
7.0.330.0040.00415.49
7.0.320.0100.00015.57
7.0.310.0070.00715.35
7.0.300.0050.00315.04
7.0.290.0070.00715.57
7.0.280.0070.00715.40
7.0.270.0080.00415.32
7.0.260.0070.01015.47
7.0.250.0040.00415.53
7.0.240.0070.00715.23
7.0.230.0040.00815.45
7.0.220.0000.01515.66
7.0.210.0070.00315.27
7.0.200.0070.00416.20
7.0.190.0050.00616.22
7.0.180.0060.00515.91
7.0.170.0020.00815.99
7.0.160.0030.00715.78
7.0.150.0040.00615.70
7.0.140.0020.00615.94
7.0.130.0020.01216.16
7.0.120.0020.00916.09
7.0.110.0060.00415.97
7.0.100.0040.00915.91
7.0.90.0050.00515.91
7.0.80.0040.00716.07
7.0.70.0070.00416.06
7.0.60.0000.01115.99
7.0.50.0030.00716.05
7.0.40.0050.00514.25
7.0.30.0060.00414.37
7.0.20.0060.00714.27
7.0.10.0040.00414.36
7.0.00.0040.00714.40
5.6.380.0080.00814.42
5.6.370.0070.00314.22
5.6.360.0000.01114.29
5.6.350.0060.00614.51
5.6.340.0040.00714.24
5.6.330.0000.01114.84
5.6.320.0040.00814.11
5.6.310.0040.01114.46
5.6.300.0060.02117.59
5.6.290.0160.01817.48
5.6.280.0060.02717.82
5.6.270.0050.02417.63
5.6.260.0060.02917.71
5.6.250.0050.02217.53
5.6.240.0050.03017.65
5.6.230.0120.02417.61
5.6.220.0070.03217.63
5.6.210.0000.02817.73
5.6.200.0060.03417.51
5.6.190.0030.02917.44
5.6.180.0090.01917.52
5.6.170.0020.02917.70
5.6.160.0040.02917.82
5.6.150.0050.03017.79
5.6.140.0050.02617.65
5.6.130.0030.02717.55
5.6.120.0090.02417.67
5.6.110.0020.02717.68
5.6.100.0050.02417.61
5.6.90.0050.02317.69
5.6.80.0030.02617.23
5.6.70.0040.02717.24
5.6.60.0150.02917.15
5.6.50.0030.02417.25
5.6.40.0040.02517.35
5.6.30.0020.02817.12
5.6.20.0020.02617.14
5.6.10.0070.02417.15
5.6.00.0100.02217.12
5.5.380.0030.02314.33
5.5.370.0080.02814.40
5.5.360.0030.03314.40
5.5.350.0040.02814.32
5.5.340.0110.02714.49
5.5.330.0020.02314.63
5.5.320.0050.02114.93
5.5.310.0030.02414.87
5.5.300.0000.02614.65
5.5.290.0030.02514.76
5.5.280.0040.03214.59
5.5.270.0010.02514.58
5.5.260.0060.02314.72
5.5.250.0080.01814.61
5.5.240.0030.02114.28
5.5.230.0000.02414.23
5.5.220.0160.01914.24
5.5.210.0020.02914.16
5.5.200.0040.02014.27
5.5.190.0020.02614.38
5.5.180.0020.02814.36
5.5.170.0040.00811.18
5.5.160.0000.02514.24
5.5.150.0020.02614.19
5.5.140.0040.03114.34
5.5.130.0020.02614.08
5.5.120.0030.02814.14
5.5.110.0030.02514.23
5.5.100.0050.02214.36
5.5.90.0050.02714.11
5.5.80.0040.03314.28
5.5.70.0000.02514.23
5.5.60.0050.03314.43
5.5.50.0000.03514.12
5.5.40.0000.02814.21
5.5.30.0050.02014.20
5.5.20.0030.03514.17
5.5.10.0030.02914.06
5.5.00.0050.01914.39
5.4.450.0060.02215.39
5.4.440.0050.02415.19
5.4.430.0060.04115.38
5.4.420.0070.02515.30
5.4.410.0020.02515.17
5.4.400.0020.03015.09
5.4.390.0000.03015.05
5.4.380.0060.02115.07
5.4.370.0050.02315.15
5.4.360.0000.02915.01
5.4.350.0020.02615.00
5.4.340.0020.02615.07
5.4.330.0090.00311.16
5.4.320.0070.01915.11
5.4.310.0130.02215.19
5.4.300.0030.01915.13
5.4.290.0020.02715.09
5.4.280.0040.02315.19
5.4.270.0040.02214.95
5.4.260.0040.02215.06
5.4.250.0070.01815.18
5.4.240.0050.03514.94
5.4.230.0060.01815.07
5.4.220.0000.02615.07
5.4.210.0040.02115.16
5.4.200.0050.02214.96
5.4.190.0080.02315.01
5.4.180.0080.03814.98
5.4.170.0050.01915.01
5.4.160.0000.02915.00
5.4.150.0050.02215.28
5.4.140.0030.02214.05
5.4.130.0080.01713.92
5.4.120.0020.02613.78
5.4.110.0040.02013.94
5.4.100.0050.02113.93
5.4.90.0030.02013.90
5.4.80.0050.02013.79
5.4.70.0020.02213.94
5.4.60.0060.01713.77
5.4.50.0030.02413.89
5.4.40.0060.01713.93
5.4.30.0040.02213.73
5.4.20.0030.02213.90
5.4.10.0020.02113.84
5.4.00.0050.01913.56
5.3.290.0030.02213.07
5.3.280.0040.02113.07
5.3.270.0030.02413.07
5.3.260.0030.03813.07
5.3.250.0020.02313.07
5.3.240.0020.02813.07
5.3.230.0100.03613.07
5.3.220.0020.02513.07
5.3.210.0000.02813.07
5.3.200.0050.02013.07
5.3.190.0020.02513.07
5.3.180.0050.02013.07
5.3.170.0030.02213.07
5.3.160.0050.01813.07
5.3.150.0040.01913.07
5.3.140.0040.02113.07
5.3.130.0080.01913.07
5.3.120.0060.01913.07
5.3.110.0070.02013.07
5.3.100.0070.03813.07
5.3.90.0020.04013.07
5.3.80.0040.02313.07
5.3.70.0030.02413.07
5.3.60.0030.02413.07
5.3.50.0020.03713.07
5.3.40.0060.01913.07
5.3.30.0060.01713.07
5.3.20.0030.02713.07
5.3.10.0050.02313.07
5.3.00.0050.02013.07
5.2.170.0000.03113.07
5.2.160.0030.02013.07
5.2.150.0060.02513.07
5.2.140.0030.02013.07
5.2.130.0060.01913.07
5.2.120.0020.02113.07
5.2.110.0030.01513.07
5.2.100.0050.01613.07
5.2.90.0000.02013.07
5.2.80.0040.02513.07
5.2.70.0020.02113.07
5.2.60.0020.02213.07
5.2.50.0020.01713.07
5.2.40.0020.02013.07
5.2.30.0030.02113.07
5.2.20.0020.01713.07
5.2.10.0060.01213.07
5.2.00.0030.01913.07
5.1.60.0050.03013.07
5.1.50.0060.01613.07
5.1.40.0030.01313.07
5.1.30.0030.02513.07
5.1.20.0110.01313.07
5.1.10.0000.01613.07
5.1.00.0030.01513.07
5.0.50.0000.01513.07
5.0.40.0030.01213.07
5.0.30.0000.02713.07
5.0.20.0050.01413.07
5.0.10.0030.02113.07
5.0.00.0070.01713.07
4.4.90.0020.01113.07
4.4.80.0010.00913.07
4.4.70.0000.01013.07
4.4.60.0030.00813.07
4.4.50.0040.00613.07
4.4.40.0020.01513.07
4.4.30.0000.01013.07
4.4.20.0040.00913.07
4.4.10.0020.01113.07
4.4.00.0030.01613.07
4.3.110.0010.00913.07
4.3.100.0020.00913.07
4.3.90.0000.01013.07
4.3.80.0050.01713.07
4.3.70.0030.01013.07
4.3.60.0030.00813.07
4.3.50.0030.00813.07
4.3.40.0000.01613.07
4.3.30.0030.01413.07
4.3.20.0000.01113.07
4.3.10.0020.01113.07
4.3.00.0010.01213.07

preferences:
41.07 ms | 401 KiB | 5 Q