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()); } public function nodeIsCollection() { return count($this); } public function getChildrenKeys() { $all = []; $children = $this->children(); foreach ($children as $key => $child) { if (!in_array($key, $all)) $all[] = $key; } return $all; } } $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>'. ' <row4 ver="4.0">my test data</row4>'. ' </rows>'. ' </body>'. '</request>'; $obj = new MyXML($s); $row = $obj->firstChild()->firstChild()->row4; var_dump($row->firstChild());

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.00918.68
8.3.50.0080.01021.27
8.3.40.0140.00718.96
8.3.30.0140.00018.95
8.3.20.0040.00418.90
8.3.10.0040.00421.22
8.3.00.0040.00422.06
8.2.180.0070.01117.00
8.2.170.0070.00722.96
8.2.160.0070.00720.78
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0050.00321.11
8.2.110.0100.00020.68
8.2.100.0080.00417.97
8.2.90.0090.00019.42
8.2.80.0050.00317.97
8.2.70.0000.01017.75
8.2.60.0080.00018.18
8.2.50.0060.00318.07
8.2.40.0000.00818.27
8.2.30.0040.00421.48
8.2.20.0000.00817.94
8.2.10.0080.00018.05
8.2.00.0060.00318.05
8.1.280.0070.01125.92
8.1.270.0080.00023.99
8.1.260.0060.00326.35
8.1.250.0040.01128.09
8.1.240.0050.00522.77
8.1.230.0040.00721.18
8.1.220.0040.00418.77
8.1.210.0000.00819.10
8.1.200.0070.00317.60
8.1.190.0090.00017.76
8.1.180.0060.00318.10
8.1.170.0000.00818.92
8.1.160.0000.00719.09
8.1.150.0060.00318.88
8.1.140.0030.00517.77
8.1.130.0000.00718.09
8.1.120.0080.00017.72
8.1.110.0040.00417.74
8.1.100.0040.00417.79
8.1.90.0000.00717.76
8.1.80.0000.00817.78
8.1.70.0000.00717.75
8.1.60.0000.00917.81
8.1.50.0000.00917.75
8.1.40.0040.00417.82
8.1.30.0040.00417.85
8.1.20.0000.00817.80
8.1.10.0040.00417.71
8.1.00.0000.00817.80
8.0.300.0000.00820.14
8.0.290.0050.00317.30
8.0.280.0030.00318.60
8.0.270.0000.00717.52
8.0.260.0000.00617.12
8.0.250.0040.00417.32
8.0.240.0060.00317.26
8.0.230.0040.00417.23
8.0.220.0040.00417.14
8.0.210.0000.00717.15
8.0.200.0030.00317.34
8.0.190.0040.00417.27
8.0.180.0040.00417.31
8.0.170.0050.00317.27
8.0.160.0040.00417.12
8.0.150.0000.00717.14
8.0.140.0000.00817.19
8.0.130.0030.00313.56
8.0.120.0040.00417.02
8.0.110.0020.00517.17
8.0.100.0040.00417.29
8.0.90.0000.00816.98
8.0.80.0100.00717.14
8.0.70.0040.00417.19
8.0.60.0040.00417.25
8.0.50.0000.00717.14
8.0.30.0070.01217.51
8.0.20.0070.01217.53
8.0.10.0000.00817.41
8.0.00.0090.00917.06
7.4.330.0060.00016.91
7.4.320.0000.00616.84
7.4.300.0070.00016.78
7.4.290.0080.00016.73
7.4.280.0000.00716.82
7.4.270.0030.00316.88
7.4.260.0050.00013.64
7.4.250.0040.00416.83
7.4.240.0000.00816.86
7.4.230.0030.00316.69
7.4.220.0110.00716.83
7.4.210.0100.00616.81
7.4.200.0040.00416.97
7.4.190.0070.00016.92
7.4.160.0040.01216.80
7.4.150.0040.01317.40
7.4.140.0100.00717.86
7.4.130.0100.00916.77
7.4.120.0100.01216.77
7.4.110.0080.00816.78
7.4.100.0120.00616.80
7.4.90.0170.00316.80
7.4.80.0100.00719.39
7.4.70.0090.01216.67
7.4.60.0060.00916.84
7.4.50.0100.00016.68
7.4.40.0060.00622.77
7.4.30.0000.01716.62
7.4.10.0090.00915.11
7.4.00.0070.01015.18
7.3.330.0030.00313.54
7.3.320.0000.00613.46
7.3.310.0030.00316.66
7.3.300.0030.00316.59
7.3.290.0120.00916.58
7.3.280.0060.00916.60
7.3.270.0140.01117.40
7.3.260.0050.01318.24
7.3.250.0090.01216.58
7.3.240.0100.01316.57
7.3.230.0130.00316.89
7.3.210.0070.01116.75
7.3.200.0070.01019.39
7.3.190.0150.00316.70
7.3.180.0070.01116.71
7.3.170.0120.00416.89
7.3.160.0000.01616.58
7.3.130.0040.01615.18
7.3.120.0030.01415.08
7.3.110.0030.01014.66
7.3.100.0100.00315.11
7.3.90.0080.00614.74
7.3.80.0030.00915.04
7.3.70.0040.01115.02
7.3.60.0000.01314.84
7.3.50.0060.01314.99
7.3.40.0090.00314.97
7.3.30.0040.00714.80
7.3.20.0090.00316.58
7.3.10.0080.00616.56
7.3.00.0060.00716.79
7.2.330.0090.00916.79
7.2.320.0160.00316.69
7.2.310.0080.00816.98
7.2.300.0140.00316.94
7.2.290.0030.01316.75
7.2.260.0060.01214.98
7.2.250.0070.01115.02
7.2.240.0060.00914.89
7.2.230.0100.00714.77
7.2.220.0070.00715.02
7.2.210.0060.00615.49
7.2.200.0090.00615.13
7.2.190.0150.00014.90
7.2.180.0060.00615.06
7.2.170.0070.00714.88
7.2.160.0060.00915.38
7.2.150.0070.01016.98
7.2.140.0070.01016.77
7.2.130.0070.00517.04
7.2.120.0050.00917.03
7.2.110.0060.00817.10
7.2.100.0060.00816.78
7.2.90.0030.00917.04
7.2.80.0070.00616.92
7.2.70.0100.00617.04
7.2.60.0040.01017.05
7.2.50.0090.00617.03
7.2.40.0050.00917.04
7.2.30.0090.00717.01
7.2.20.0020.01116.85
7.2.10.0110.00616.99
7.2.00.0050.00817.67
7.1.330.0030.01015.79
7.1.320.0040.00415.86
7.1.310.0070.01115.84
7.1.300.0000.00915.70
7.1.290.0030.00715.66
7.1.280.0110.00315.70
7.1.270.0060.00315.92
7.1.260.0070.00715.55
7.1.250.0070.00615.80
7.1.240.0070.00515.61
7.1.230.0070.00615.71
7.1.220.0080.00315.77
7.1.210.0050.00915.75
7.1.200.0060.00715.73
7.1.190.0000.01215.69
7.1.180.0060.00515.54
7.1.170.0030.01115.65
7.1.160.0090.00415.51
7.1.150.0030.00715.92
7.1.140.0070.00815.78
7.1.130.0060.00615.76
7.1.120.0000.01315.77
7.1.110.0070.00415.55
7.1.100.0050.00916.51
7.1.90.0070.00715.68
7.1.80.0070.00715.84
7.1.70.0080.00416.26
7.1.60.0060.01216.99
7.1.50.0130.00816.34
7.1.40.0040.01115.56
7.1.30.0060.00415.75
7.1.20.0060.00315.66
7.1.10.0080.00715.62
7.1.00.0050.02918.04
7.0.330.0050.00815.64
7.0.320.0030.00815.47
7.0.310.0110.00515.24
7.0.300.0050.00515.11
7.0.290.0050.00715.38
7.0.280.0100.00315.48
7.0.270.0060.00815.54
7.0.260.0120.00515.34
7.0.250.0070.00515.39
7.0.240.0070.00815.47
7.0.230.0060.00615.43
7.0.220.0090.00715.27
7.0.210.0000.01615.48
7.0.200.0070.00815.98
7.0.190.0040.00915.61
7.0.180.0050.00815.64
7.0.170.0070.00715.54
7.0.160.0070.00815.46
7.0.150.0090.00815.46
7.0.140.0040.02917.60
7.0.130.0050.01015.45
7.0.120.0050.00815.69
7.0.110.0080.00715.34
7.0.100.0020.01115.57
7.0.90.0050.00915.39
7.0.80.0030.01015.49
7.0.70.0090.00615.43
7.0.60.0100.02716.98
7.0.50.0110.03016.24
7.0.40.0070.01915.76
7.0.30.0160.03015.79
7.0.20.0110.02515.65
7.0.10.0130.01715.69
7.0.00.0070.03115.63
5.6.400.0000.01314.80
5.6.390.0040.00814.09
5.6.380.0020.01114.62
5.6.370.0050.00814.47
5.6.360.0100.00214.48
5.6.350.0100.00714.54
5.6.340.0060.00814.48
5.6.330.0090.00814.33
5.6.320.0050.00914.55
5.6.310.0070.00714.57
5.6.300.0020.01314.49
5.6.290.0020.01014.34
5.6.280.0050.02916.50
5.6.270.0090.00514.34
5.6.260.0090.00414.37
5.6.250.0050.01014.36
5.6.240.0080.00514.32
5.6.230.0110.00514.38
5.6.220.0040.00714.64
5.6.210.0020.03516.36
5.6.200.0060.03615.64
5.6.190.0090.01816.52
5.6.180.0160.02616.62
5.6.170.0140.03116.41
5.6.160.0050.01616.47
5.6.150.0050.03315.65
5.6.140.0050.01915.69
5.6.130.0070.03215.70
5.6.120.0020.02216.67
5.6.110.0050.02816.53
5.6.100.0080.03216.58
5.6.90.0090.03216.46
5.6.80.0110.01716.35
5.6.70.0090.03016.32
5.6.60.0020.01014.22
5.6.50.0100.00514.47
5.6.40.0060.01114.31
5.6.30.0040.01214.41
5.6.20.0070.00914.39
5.6.10.0080.00814.34
5.6.00.0070.00914.36
5.5.380.0090.00312.72
5.5.370.0030.00512.70
5.5.360.0040.00812.86
5.5.350.0150.02715.29
5.5.340.0060.02914.49
5.5.330.0100.02915.38
5.5.320.0090.01915.32
5.5.310.0110.03015.28
5.5.300.0060.03114.41
5.5.290.0050.01814.56
5.5.280.0020.02115.55
5.5.270.0090.03115.61
5.5.260.0050.03015.41
5.5.250.0070.03015.40
5.5.240.0060.01815.25
5.5.230.0050.01012.76
5.5.220.0050.00712.75
5.5.210.0080.00312.79
5.5.200.0060.00812.69
5.5.190.0070.00612.80
5.5.180.0060.00612.67
5.5.170.0090.00512.74
5.5.160.0050.00612.65
5.5.150.0030.00912.76
5.5.140.0050.00812.77
5.5.130.0060.00512.97
5.5.120.0040.00812.79
5.5.110.0070.00312.70
5.5.100.0070.00712.74
5.5.90.0030.00712.66
5.5.80.0050.01012.69
5.5.70.0070.00712.55
5.5.60.0050.00712.74
5.5.50.0020.01112.78
5.5.40.0030.01012.69
5.5.30.0060.00612.56
5.5.20.0030.00712.84
5.5.10.0060.00212.55
5.5.00.0080.00312.86
5.4.450.0050.03114.23
5.4.440.0050.02814.12
5.4.430.0040.02514.13
5.4.420.0090.01514.06
5.4.410.0030.01814.17
5.4.400.0020.03213.97
5.4.390.0060.02814.00
5.4.380.0050.02714.03
5.4.370.0020.02013.97
5.4.360.0030.01713.91
5.4.350.0060.01514.10
5.4.340.0080.01714.06
5.4.330.0090.00311.36
5.4.320.0050.02813.95
5.4.310.0050.02814.15
5.4.300.0040.02113.98
5.4.290.0020.02214.02
5.4.280.0030.03313.96
5.4.270.0080.02113.99
5.4.260.0030.02013.98
5.4.250.0050.02914.01
5.4.240.0030.02913.98
5.4.230.0020.02014.03
5.4.220.0050.02614.01
5.4.210.0060.02914.03
5.4.200.0030.02113.98
5.4.190.0070.02014.04
5.4.180.0020.02014.03
5.4.170.0060.02113.95
5.4.160.0070.02213.99
5.4.150.0040.03014.09
5.4.140.0060.02613.15
5.4.130.0030.02713.15
5.4.120.0080.02213.28
5.4.110.0010.02113.20
5.4.100.0050.02813.14
5.4.90.0090.02313.07
5.4.80.0050.01913.18
5.4.70.0060.01713.14
5.4.60.0040.01813.20
5.4.50.0040.02013.16
5.4.40.0040.01613.11
5.4.30.0060.01813.13
5.4.20.0050.01613.15
5.4.10.0060.01813.09
5.4.00.0030.02312.93
5.3.290.0060.02612.31
5.3.280.0010.03312.18
5.3.270.0070.02712.13
5.3.260.0030.02912.21
5.3.250.0050.02312.17
5.3.240.0030.03012.16
5.3.230.0020.02412.27
5.3.220.0050.01912.21
5.3.210.0060.02412.17
5.3.200.0020.02412.14
5.3.190.0020.02712.21
5.3.180.0030.03112.27
5.3.170.0040.01612.30
5.3.160.0030.02812.28
5.3.150.0100.01212.15
5.3.140.0030.02112.17
5.3.130.0050.02212.20
5.3.120.0030.01712.27
5.3.110.0070.01412.22
5.3.100.0040.01211.96
5.3.90.0050.01812.09
5.3.80.0040.01811.99
5.3.70.0010.02611.97
5.3.60.0040.02011.98
5.3.50.0050.01811.95
5.3.40.0020.02311.93
5.3.30.0050.01811.96
5.3.20.0040.01511.93
5.3.10.0030.01711.82
5.3.00.0040.01211.85
5.2.170.0060.01510.61
5.2.160.0020.01510.64
5.2.150.0020.01810.62
5.2.140.0040.01510.62
5.2.130.0010.01810.60
5.2.120.0020.01910.60
5.2.110.0070.01510.61
5.2.100.0040.01510.67
5.2.90.0010.01810.64
5.2.80.0040.01510.68
5.2.70.0010.01610.66
5.2.60.0030.01510.70
5.2.50.0050.01710.64
5.2.40.0040.01610.55
5.2.30.0020.01810.55
5.2.20.0030.01710.53
5.2.10.0000.01710.57
5.2.00.0040.01710.44
5.1.60.0020.01610.20
5.1.50.0020.02110.21
5.1.40.0020.01410.07
5.1.30.0060.01510.26
5.1.20.0020.01510.27
5.1.10.0030.01310.09
5.1.00.0010.01510.15
5.0.50.0020.0139.70
5.0.40.0020.0179.70
5.0.30.0000.0219.70
5.0.20.0040.0119.70
5.0.10.0000.0129.70
5.0.00.0030.0209.70
4.4.90.0020.0149.70
4.4.80.0020.0109.70
4.4.70.0020.0089.70
4.4.60.0020.0109.70
4.4.50.0020.0109.70
4.4.40.0040.0129.70
4.4.30.0040.0099.70
4.4.20.0040.0109.70
4.4.10.0030.0089.70
4.4.00.0050.0119.70
4.3.110.0050.0079.70
4.3.100.0040.0079.70
4.3.90.0020.0119.70
4.3.80.0020.0139.70
4.3.70.0010.0089.70
4.3.60.0030.0089.70
4.3.50.0000.0149.70
4.3.40.0020.0179.70
4.3.30.0070.0079.70
4.3.20.0010.0119.70
4.3.10.0000.0119.70
4.3.00.0000.0119.70

preferences:
63.3 ms | 401 KiB | 5 Q