3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCollectionParentIDFromChildID($cID) { if(is_numeric($cID)) { if($cID > 1) { return '1'; } if($cID == 1) { return '0'; } } return null; } function populateParentIDArray_current($cID) { global $cParentIDArray; $cParentID = getCollectionParentIDFromChildID($cID); if($cParentID > -1) { if(!in_array($cParentID, $cParentIDArray)) { $cParentIDArray[] = $cParentID; } populateParentIDArray_current($cParentID); } } function populateParentIDArray_new($cID) { global $cParentIDArray; $cParentID = getCollectionParentIDFromChildID($cID); if(is_numeric($cParentID)) { if(!in_array($cParentID, $cParentIDArray)) { $cParentIDArray[] = $cParentID; } if($cParentID > 0) { populateParentIDArray_new($cParentID); } } } function runTest($cID) { global $cParentIDArray; echo "Test case for "; var_dump($cID); $cParentIDArray = array(); populateParentIDArray_current($cID); echo "CURRENT: \n"; var_dump($cParentIDArray); $cParentIDArray = array(); populateParentIDArray_new($cID); echo "CURRENT: \n"; var_dump($cParentIDArray); } runTest('3'); runTest('1'); runTest('0'); runTest(3); runTest(1); runTest(0); runTest(null); runTest('');

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.0080.00818.55
8.3.50.0100.01022.05
8.3.40.0070.01518.88
8.3.30.0190.00318.84
8.3.20.0030.00818.79
8.3.10.0080.00021.00
8.3.00.0070.00323.71
8.2.180.0070.00716.88
8.2.170.0160.00622.96
8.2.160.0070.00720.55
8.2.150.0160.00324.18
8.2.140.0000.00824.66
8.2.130.0130.00626.16
8.2.120.0040.00417.75
8.2.110.0070.00422.30
8.2.100.0040.00817.84
8.2.90.0030.00619.30
8.2.80.0080.00018.05
8.2.70.0030.00617.63
8.2.60.0040.00417.93
8.2.50.0030.00518.07
8.2.40.0080.00018.34
8.2.30.0000.00821.32
8.2.20.0040.00417.68
8.2.10.0040.00417.69
8.2.00.0030.00617.79
8.1.280.0150.00625.92
8.1.270.0100.00022.05
8.1.260.0150.00626.35
8.1.250.0030.01628.09
8.1.240.0100.00022.41
8.1.230.0040.00820.90
8.1.220.0040.00418.77
8.1.210.0070.00319.04
8.1.200.0000.00917.36
8.1.190.0000.00817.54
8.1.180.0140.00018.10
8.1.170.0040.00418.64
8.1.160.0050.00318.92
8.1.150.0000.00818.68
8.1.140.0000.00817.47
8.1.130.0040.00417.73
8.1.120.0020.00517.57
8.1.110.0080.00017.55
8.1.100.0030.00517.52
8.1.90.0000.00717.51
8.1.80.0000.00717.49
8.1.70.0020.00517.37
8.1.60.0060.00317.65
8.1.50.0080.00017.39
8.1.40.0000.00917.60
8.1.30.0000.00817.57
8.1.20.0040.00417.52
8.1.10.0040.00417.56
8.1.00.0050.00317.44
8.0.300.0110.00719.84
8.0.290.0030.00616.75
8.0.280.0000.00818.38
8.0.270.0060.00317.21
8.0.260.0030.00316.78
8.0.250.0040.00416.96
8.0.240.0070.00417.02
8.0.230.0000.00716.94
8.0.220.0080.00316.99
8.0.210.0050.00316.95
8.0.200.0040.00416.89
8.0.190.0000.00917.08
8.0.180.0040.00416.85
8.0.170.0030.00616.88
8.0.160.0040.00416.97
8.0.150.0000.00716.90
8.0.140.0040.00416.79
8.0.130.0060.00013.42
8.0.120.0040.00416.93
8.0.110.0000.00716.75
8.0.100.0000.00716.95
8.0.90.0000.00916.82
8.0.80.0110.00416.97
8.0.70.0040.00416.88
8.0.60.0000.00816.95
8.0.50.0050.00316.93
8.0.30.0110.00817.07
8.0.20.0130.01217.40
8.0.10.0040.00416.87
8.0.00.0120.00916.81
7.4.330.0000.00514.83
7.4.320.0030.00316.54
7.4.300.0000.00716.65
7.4.290.0000.00716.43
7.4.280.0040.00416.61
7.4.270.0000.00816.52
7.4.260.0050.00013.29
7.4.250.0050.00216.50
7.4.240.0000.00816.57
7.4.230.0000.00716.39
7.4.220.0090.01416.59
7.4.210.0060.01016.59
7.4.200.0000.00816.61
7.4.190.0000.00716.67
7.4.160.0090.00916.38
7.4.150.0040.01517.40
7.4.140.0140.00817.86
7.4.130.0120.00616.65
7.4.120.0150.00716.51
7.4.110.0150.00316.55
7.4.100.0190.00016.69
7.4.90.0090.01216.53
7.4.80.0150.00419.39
7.4.70.0090.00916.43
7.4.60.0120.00616.55
7.4.50.0000.00916.49
7.4.40.0070.01122.52
7.4.30.0060.01216.52
7.4.00.0120.00714.80
7.3.330.0030.00313.11
7.3.320.0030.00313.10
7.3.310.0040.00416.23
7.3.300.0070.00016.25
7.3.290.0140.00016.34
7.3.280.0110.00816.32
7.3.270.0070.02117.40
7.3.260.0160.00918.24
7.3.250.0100.00816.49
7.3.240.0070.01116.58
7.3.230.0120.00616.39
7.3.210.0120.00916.33
7.3.200.0110.00819.39
7.3.190.0070.01116.50
7.3.180.0090.00616.50
7.3.170.0030.01316.56
7.3.160.0030.01316.43
7.3.120.0080.00714.65
7.3.110.0050.01214.74
7.3.100.0050.01114.83
7.3.90.0050.00914.53
7.3.80.0040.00914.55
7.3.70.0080.00814.93
7.3.60.0060.00814.67
7.3.50.0100.00314.78
7.3.40.0050.00914.72
7.3.30.0020.01014.66
7.3.20.0110.00516.64
7.3.10.0060.00816.49
7.3.00.0060.00716.56
7.2.330.0070.01116.60
7.2.320.0060.01416.77
7.2.310.0070.01716.53
7.2.300.0030.01316.45
7.2.290.0110.00716.84
7.2.250.0070.01215.04
7.2.240.0040.01615.14
7.2.230.0090.00814.85
7.2.220.0080.00315.13
7.2.210.0060.00914.91
7.2.200.0030.01115.15
7.2.190.0100.00514.93
7.2.180.0080.00814.92
7.2.170.0080.00615.04
7.2.160.0090.00415.15
7.2.150.0070.01016.64
7.2.140.0030.01516.99
7.2.130.0060.00616.95
7.2.120.0100.00716.89
7.2.110.0100.00716.98
7.2.100.0140.00316.99
7.2.90.0000.01716.91
7.2.80.0040.01516.91
7.2.70.0060.00616.72
7.2.60.0000.01116.64
7.2.50.0030.00616.79
7.2.40.0110.00416.97
7.2.30.0100.00316.85
7.2.20.0050.00516.88
7.2.10.0070.00316.82
7.2.00.0050.01018.16
7.1.330.0080.00815.87
7.1.320.0050.00815.72
7.1.310.0040.01215.76
7.1.300.0040.00615.91
7.1.290.0090.00415.67
7.1.280.0020.01015.71
7.1.270.0030.01315.66
7.1.260.0030.01015.73
7.1.250.0000.01615.82
7.1.100.0040.00818.08
7.1.70.0030.00717.07
7.1.60.0140.01019.40
7.1.50.0030.01417.05
7.1.00.0000.08022.42
7.0.200.0000.00716.59
7.0.140.0000.05022.10
7.0.70.0030.06019.94
7.0.60.0030.05319.98
7.0.50.0100.07020.39
7.0.40.0130.08020.07
7.0.30.0130.04020.04
7.0.20.0000.08720.04
7.0.10.0070.06320.07
7.0.00.0100.08020.05
5.6.280.0030.07321.05
5.6.220.0000.09320.50
5.6.210.0070.08020.77
5.6.200.0170.07721.05
5.6.190.0030.09021.11
5.6.180.0100.08720.94
5.6.170.0030.08721.03
5.6.160.0030.08721.04
5.6.150.0070.08721.07
5.6.140.0030.08721.04
5.6.130.0170.08321.03
5.6.120.0100.08021.18
5.6.110.0100.08321.06
5.6.100.0130.05321.04
5.6.90.0130.08721.16
5.6.80.0070.07320.51
5.6.70.0070.08320.33
5.6.60.0070.07720.33
5.6.50.0070.08020.33
5.6.40.0130.06720.39
5.6.30.0070.09020.26
5.6.20.0100.08320.30
5.6.10.0170.06020.46
5.6.00.0030.05720.39
5.5.360.0030.09020.36
5.5.350.0030.08320.45
5.5.340.0330.06720.66
5.5.330.0070.04720.74
5.5.320.0070.04020.84
5.5.310.0070.08320.81
5.5.300.0130.08320.84
5.5.290.0100.07720.87
5.5.280.0170.07720.81
5.5.270.0270.06320.90
5.5.260.0200.07020.93
5.5.250.0000.08720.74
5.5.240.0070.06720.28
5.5.230.0030.05720.30
5.5.220.0170.05020.21
5.5.210.0130.07320.30
5.5.200.0100.07720.12
5.5.190.0070.08020.13
5.5.180.0030.07320.15
5.5.160.0130.06320.13
5.5.150.0030.06020.15
5.5.140.0100.08020.13
5.5.130.0070.07320.21
5.5.120.0100.08020.12
5.5.110.0130.07720.21
5.5.100.0230.06020.17
5.5.90.0130.07320.02
5.5.80.0030.06719.96
5.5.70.0000.06720.11
5.5.60.0030.08020.14
5.5.50.0130.07320.05
5.5.40.0170.07020.06
5.5.30.0130.07320.16
5.5.20.0100.07320.06
5.5.10.0130.07720.06
5.5.00.0100.07020.09
5.4.450.0100.08019.42
5.4.440.0070.05719.18
5.4.430.0000.05719.44
5.4.420.0070.08719.45
5.4.410.0070.08019.23
5.4.400.0070.08019.06
5.4.390.0100.07319.00
5.4.380.0070.06018.86
5.4.370.0100.07018.85
5.4.360.0070.07719.03
5.4.350.0030.08019.04
5.4.340.0000.08319.13
5.4.320.0000.09019.14
5.4.310.0100.07319.09
5.4.300.0000.08319.13
5.4.290.0070.05719.16
5.4.280.0100.07319.16
5.4.270.0100.07019.03
5.4.260.0030.05719.12
5.4.250.0100.07319.02
5.4.240.0070.03719.12
5.4.230.0130.07019.12
5.4.220.0070.07319.22
5.4.210.0070.07318.87
5.4.200.0100.06718.87
5.4.190.0170.07019.08
5.4.180.0030.07718.84
5.4.170.0100.05019.20
5.4.160.0200.05718.93
5.4.150.0000.08018.98
5.4.140.0070.07716.39
5.4.130.0100.06716.39
5.4.120.0070.05316.47
5.4.110.0130.07316.52
5.4.100.0000.07716.38
5.4.90.0030.06716.39
5.4.80.0170.06016.36
5.4.70.0100.06716.28
5.4.60.0070.06016.32
5.4.50.0130.06716.31
5.4.40.0030.06716.35
5.4.30.0100.07016.45
5.4.20.0100.05316.44
5.4.10.0070.07716.44
5.4.00.0030.06715.86
5.3.290.0130.07714.82
5.3.280.0070.07714.70
5.3.270.0130.07714.71
5.3.260.0030.07014.66
5.3.250.0070.07714.72
5.3.240.0100.07014.55
5.3.230.0100.06314.56
5.3.220.0270.06714.61
5.3.210.0170.07714.67
5.3.200.0100.07014.56
5.3.190.0130.07314.58
5.3.180.0030.05714.63
5.3.170.0000.08014.60
5.3.160.0100.07014.54
5.3.150.0070.06314.71
5.3.140.0100.08014.68
5.3.130.0100.07714.53
5.3.120.0100.05314.52
5.3.110.0030.07714.61
5.3.100.0100.03014.16
5.3.90.0070.06313.96
5.3.80.0070.07714.03
5.3.70.0130.05714.09
5.3.60.0070.07314.04
5.3.50.0070.05313.97
5.3.40.0130.07014.08
5.3.30.0130.05014.04
5.3.20.0130.04313.82
5.3.10.0000.05713.69
5.3.00.0100.06713.63
5.2.170.0030.04311.16
5.2.160.0070.05711.04
5.2.150.0100.06011.04
5.2.140.0030.04011.04
5.2.130.0230.03711.23
5.2.120.0130.03711.11
5.2.110.0030.05011.17
5.2.100.0030.03011.00
5.2.90.0100.05711.18
5.2.80.0030.06711.16
5.2.70.0070.05711.11
5.2.60.0070.06311.16
5.2.50.0070.05310.94
5.2.40.0030.05311.07
5.2.30.0030.05010.84
5.2.20.0030.06011.06
5.2.10.0130.05310.86
5.2.00.0070.05310.66
5.1.60.0000.04310.57
5.1.50.0030.04010.57
5.1.40.0070.04710.57
5.1.30.0000.04310.57
5.1.20.0100.05010.57
5.1.10.0100.05310.57
5.1.00.0170.04710.57
5.0.50.0030.04310.57
5.0.40.0070.04310.57
5.0.30.0030.06310.57
5.0.20.0030.04310.57
5.0.10.0000.05010.57
5.0.00.0070.06710.57
4.4.90.0000.03710.57
4.4.80.0070.03310.57
4.4.70.0030.03710.57
4.4.60.0030.03310.57
4.4.50.0030.03010.57
4.4.40.0070.03010.57
4.4.30.0000.04010.57
4.4.20.0000.04010.57
4.4.10.0030.03310.57
4.4.00.0030.05310.57
4.3.110.0030.03710.57
4.3.100.0030.03710.57
4.3.90.0030.03710.57
4.3.80.0000.05710.57
4.3.70.0030.02710.57
4.3.60.0000.02310.57
4.3.50.0030.03710.57
4.3.40.0000.04310.57
4.3.30.0000.03010.57
4.3.20.0000.04010.57
4.3.10.0030.03310.57
4.3.00.0000.03710.57

preferences:
35.53 ms | 401 KiB | 5 Q