3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); 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); ob_start(); var_dump($cParentIDArray); $current = ob_get_contents(); ob_end_clean(); $cParentIDArray = array(); populateParentIDArray_new($cID); ob_start(); var_dump($cParentIDArray); $new = ob_get_contents(); ob_end_clean(); if($current === $new) { echo "Passed: ", $current; } else { echo "###ERROR\nCURRENT: ", $current, "\nNEW: ", $new, "\n"; } } 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.0070.01316.75
8.3.50.0090.00917.38
8.3.40.0070.01118.62
8.3.30.0070.01118.76
8.3.20.0040.00418.50
8.3.10.0060.00320.50
8.3.00.0000.00819.38
8.2.180.0100.00618.16
8.2.170.0070.00722.96
8.2.160.0040.01120.41
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0070.00420.49
8.2.110.0030.00721.12
8.2.100.0110.00017.72
8.2.90.0030.00719.36
8.2.80.0080.00017.97
8.2.70.0030.00617.75
8.2.60.0050.00317.92
8.2.50.0040.00418.07
8.2.40.0050.00519.88
8.2.30.0000.00718.15
8.2.20.0030.00619.34
8.2.10.0040.00417.85
8.2.00.0040.00417.88
8.1.280.0120.00325.92
8.1.270.0000.00823.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0100.00021.43
8.1.230.0080.00417.42
8.1.220.0030.00517.77
8.1.210.0060.00318.77
8.1.200.0030.00617.35
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0050.00318.93
8.1.160.0000.00818.88
8.1.150.0000.00718.68
8.1.140.0000.00717.43
8.1.130.0000.00717.78
8.1.120.0000.00717.54
8.1.110.0000.00817.45
8.1.100.0000.00717.43
8.1.90.0030.00617.41
8.1.80.0030.00517.45
8.1.70.0000.00717.48
8.1.60.0040.00417.64
8.1.50.0030.00517.41
8.1.40.0050.00317.54
8.1.30.0050.00317.75
8.1.20.0080.00017.74
8.1.10.0000.00817.58
8.1.00.0040.00417.54
8.0.300.0000.00818.77
8.0.290.0000.00716.88
8.0.280.0030.00618.49
8.0.270.0030.00317.24
8.0.260.0030.00516.79
8.0.250.0070.00016.98
8.0.240.0000.00817.03
8.0.230.0030.00516.99
8.0.220.0000.00716.90
8.0.210.0000.00816.93
8.0.200.0000.00617.06
8.0.190.0080.00016.89
8.0.180.0050.00316.93
8.0.170.0030.00616.79
8.0.160.0070.00017.06
8.0.150.0030.00616.77
8.0.140.0090.00316.91
8.0.130.0030.00313.34
8.0.120.0050.00316.94
8.0.110.0020.00516.77
8.0.100.0050.00216.94
8.0.90.0060.00316.89
8.0.80.0060.01016.88
8.0.70.0040.00417.00
8.0.60.0040.00416.81
8.0.50.0030.00516.95
8.0.30.0110.00716.88
8.0.20.0090.01517.13
8.0.10.0050.00216.96
8.0.00.0140.00816.74
7.4.330.0000.00613.11
7.4.320.0000.00616.66
7.4.300.0030.00316.67
7.4.290.0030.00316.57
7.4.280.0060.00316.66
7.4.270.0030.00316.64
7.4.260.0050.00013.33
7.4.250.0030.00616.64
7.4.240.0000.00716.46
7.4.230.0020.00516.64
7.4.220.0130.00316.71
7.4.210.0090.01216.68
7.4.200.0000.00716.52
7.4.190.0070.00016.74
7.4.160.0080.00816.53
7.4.150.0100.00716.61
7.4.140.0060.01216.48
7.4.130.0120.00816.51
7.4.120.0080.00816.52
7.4.110.0000.02216.43
7.4.100.0160.00716.66
7.4.90.0090.00916.63
7.4.80.0130.00419.39
7.4.70.0040.01216.82
7.4.60.0060.00916.62
7.4.50.0030.00616.48
7.4.40.0060.01216.57
7.4.30.0180.00016.68
7.4.00.0050.01015.12
7.3.330.0030.00313.38
7.3.320.0000.00513.41
7.3.310.0040.00416.46
7.3.300.0000.00716.29
7.3.290.0100.00416.39
7.3.280.0100.00516.43
7.3.270.0130.01316.62
7.3.260.0070.01016.52
7.3.250.0100.01116.43
7.3.240.0060.01116.46
7.3.230.0100.00616.49
7.3.210.0150.00316.34
7.3.200.0140.00316.53
7.3.190.0040.01216.68
7.3.180.0060.00916.73
7.3.170.0090.00616.60
7.3.160.0090.00916.46
7.3.120.0080.00715.03
7.3.110.0120.00615.00
7.3.100.0070.01114.97
7.3.90.0040.01114.76
7.3.80.0060.00914.98
7.3.70.0030.01015.00
7.3.60.0040.01314.78
7.3.50.0050.00914.87
7.3.40.0070.00514.91
7.3.30.0100.00315.05
7.3.20.0070.00816.63
7.3.10.0070.00816.75
7.3.00.0050.00916.76
7.2.330.0140.00616.55
7.2.320.0030.01416.80
7.2.310.0140.00716.47
7.2.300.0100.01016.85
7.2.290.0120.00616.82
7.2.250.0050.01314.97
7.2.240.0110.00815.22
7.2.230.0130.00515.11
7.2.220.0030.01715.14
7.2.210.0030.01114.95
7.2.200.0050.01115.24
7.2.190.0020.01315.13
7.2.180.0060.00815.13
7.2.170.0060.00914.90
7.2.130.0060.00916.93
7.2.120.0070.00816.84
7.2.110.0060.01016.72
7.2.100.0060.00616.86
7.2.90.0040.01116.89
7.2.80.0050.00916.74
7.2.70.0060.00616.93
7.2.60.0040.00816.86
7.2.50.0040.00816.89
7.2.40.0080.00416.86
7.2.30.0060.00317.10
7.2.20.0060.00616.79
7.2.10.0050.00517.00
7.2.00.0060.00917.71
7.1.330.0070.01015.73
7.1.320.0050.01015.76
7.1.310.0060.00716.00
7.1.300.0040.01115.56
7.1.290.0070.00915.78
7.1.280.0070.00715.54
7.1.270.0050.00716.00
7.1.260.0080.00315.86
7.1.250.0070.00515.86
7.1.240.0040.00415.46
7.1.230.0120.00015.84
7.1.220.0070.00415.65
7.1.210.0100.00315.78
7.1.200.0060.00615.80
7.1.190.0000.01115.94
7.1.180.0030.00615.83
7.1.170.0030.00615.82
7.1.160.0030.00615.87
7.1.150.0050.00315.82
7.1.140.0000.01415.82
7.1.130.0110.00415.94
7.1.120.0070.00715.70
7.1.110.0080.00315.84
7.1.100.0040.00917.00
7.1.90.0060.00615.66
7.1.80.0000.01015.86
7.1.70.0030.01016.42
7.1.60.0120.00717.55
7.1.50.0050.01216.33
7.1.40.0030.00915.73
7.1.30.0040.01115.57
7.1.20.0110.00415.72
7.1.10.0030.01015.73
7.1.00.0050.04019.14
7.0.330.0030.00715.62
7.0.320.0060.00315.47
7.0.310.0040.00815.50
7.0.300.0030.00315.28
7.0.290.0060.00615.35
7.0.280.0110.00415.57
7.0.270.0030.01015.25
7.0.260.0060.00615.34
7.0.250.0070.00415.45
7.0.240.0100.00315.24
7.0.230.0070.00715.48
7.0.220.0060.00615.47
7.0.210.0040.00815.10
7.0.200.0100.00315.09
7.0.190.0040.00815.52
7.0.180.0060.00315.27
7.0.170.0030.00915.52
7.0.160.0080.00615.55
7.0.150.0110.00315.18
7.0.140.0090.03518.78
7.0.130.0070.01015.38
7.0.120.0050.03718.71
7.0.110.0000.00815.48
7.0.100.0070.00315.31
7.0.90.0060.00315.65
7.0.80.0090.00315.24
7.0.70.0070.00715.56
7.0.60.0100.04017.70
7.0.50.0070.04716.62
7.0.40.0070.04316.88
7.0.30.0140.04516.95
7.0.20.0160.02216.88
7.0.10.0080.03616.74
7.0.00.0040.04116.77
5.6.380.0040.01114.76
5.6.370.0000.01214.55
5.6.360.0060.00314.51
5.6.350.0000.01514.75
5.6.340.0060.00914.57
5.6.330.0040.01114.20
5.6.320.0080.00313.96
5.6.310.0030.00714.84
5.6.300.0080.00714.42
5.6.290.0000.01614.30
5.6.280.0060.04017.55
5.6.270.0140.00314.35
5.6.260.0150.00014.43
5.6.250.0030.00914.24
5.6.240.0030.01014.30
5.6.230.0070.00714.21
5.6.220.0030.01314.45
5.6.210.0090.03317.60
5.6.200.0070.02416.33
5.6.190.0050.04717.52
5.6.180.0200.03817.39
5.6.170.0100.02717.41
5.6.160.0060.04617.37
5.6.150.0040.02516.35
5.6.140.0050.03016.28
5.6.130.0080.03216.41
5.6.120.0060.03317.86
5.6.110.0130.04217.77
5.6.100.0150.03717.68
5.6.90.0120.03817.67
5.6.80.0000.04417.21
5.6.70.0060.00914.69
5.6.60.0050.00514.16
5.6.50.0000.01314.03
5.6.40.0070.01014.29
5.6.30.0090.00614.40
5.6.20.0060.00314.41
5.6.10.0110.00314.45
5.6.00.0070.00714.29
5.5.380.0100.00011.49
5.5.370.0030.00911.44
5.5.360.0000.01411.51
5.5.350.0020.01915.88
5.5.340.0080.02014.74
5.5.330.0050.04315.77
5.5.320.0080.03515.88
5.5.310.0070.02315.80
5.5.300.0030.02414.71
5.5.290.0050.02214.71
5.5.280.0050.04015.95
5.5.270.0050.04615.99
5.5.260.0100.03815.96
5.5.250.0020.04515.71
5.5.240.0030.04015.49
5.5.230.0060.00611.03
5.5.220.0060.00311.23
5.5.210.0080.00310.91
5.5.200.0040.00711.24
5.5.190.0030.00611.38
5.5.180.0000.01111.20
5.5.170.0000.01111.36
5.5.160.0000.00711.18
5.5.150.0070.00411.23
5.5.140.0080.00410.93
5.5.130.0100.00511.08
5.5.120.0000.00911.34
5.5.110.0080.00411.32
5.5.100.0110.00011.15
5.5.90.0000.01311.09
5.5.80.0070.00310.99
5.5.70.0030.00711.28
5.5.60.0030.00711.14
5.5.50.0060.00010.95
5.5.40.0030.00311.36
5.5.30.0060.00611.35
5.5.20.0000.00711.27
5.5.10.0110.00011.32
5.5.00.0040.00811.01
5.4.450.0090.02815.50
5.4.440.0050.02315.12
5.4.430.0090.02015.18
5.4.420.0030.02815.25
5.4.410.0050.04015.15
5.4.400.0060.04015.05
5.4.390.0050.03015.15
5.4.380.0100.01815.11
5.4.370.0050.03515.08
5.4.360.0050.03615.22
5.4.350.0020.02515.01
5.4.340.0150.01614.76
5.4.330.0000.00710.97
5.4.320.0000.02414.94
5.4.310.0030.02415.05
5.4.300.0060.02915.08
5.4.290.0070.03715.06
5.4.280.0080.02015.22
5.4.270.0070.02415.11
5.4.260.0080.02815.22
5.4.250.0030.02215.13
5.4.240.0070.03315.02
5.4.230.0070.04014.95
5.4.220.0090.01714.98
5.4.210.0100.02315.07
5.4.200.0090.01914.87
5.4.190.0050.01814.91
5.4.180.0020.02915.20
5.4.170.0100.02714.94
5.4.160.0020.03214.85
5.4.150.0050.02015.00
5.4.140.0050.02013.64
5.4.130.0050.02013.82
5.4.120.0040.02013.65
5.4.110.0020.02313.83
5.4.100.0040.02013.70
5.4.90.0040.03514.03
5.4.80.0070.03913.77
5.4.70.0110.03313.85
5.4.60.0000.02613.83
5.4.50.0030.02413.86
5.4.40.0030.02013.68
5.4.30.0080.03813.85
5.4.20.0050.03813.85
5.4.10.0040.03013.82
5.4.00.0070.03313.55
5.3.290.0050.02312.71
5.3.280.0030.02612.64
5.3.270.0020.02512.46
5.3.260.0000.02712.52
5.3.250.0070.03212.50
5.3.240.0020.03312.48
5.3.230.0050.03012.57
5.3.220.0060.03312.47
5.3.210.0030.02812.62
5.3.200.0050.02312.53
5.3.190.0050.04012.62
5.3.180.0000.03212.60
5.3.170.0060.03312.69
5.3.160.0040.04512.52
5.3.150.0040.04212.69
5.3.140.0050.02112.58
5.3.130.0060.02012.70
5.3.120.0020.02112.70
5.3.110.0030.04412.62
5.3.100.0030.02312.37
5.3.90.0070.02312.38
5.3.80.0040.04412.14
5.3.70.0030.03212.32
5.3.60.0040.03912.36
5.3.50.0020.02612.22
5.3.40.0040.02212.19
5.3.30.0040.02112.41
5.3.20.0030.03412.12
5.3.10.0040.02212.03
5.3.00.0020.02412.00
5.2.170.0020.02810.70
5.2.160.0080.01910.69
5.2.150.0000.01810.71
5.2.140.0050.03210.64
5.2.130.0040.01710.65
5.2.120.0020.01710.72
5.2.110.0070.03210.68
5.2.100.0000.02310.63
5.2.90.0050.01710.65
5.2.80.0070.03210.62
5.2.70.0060.02710.66
5.2.60.0020.01910.65
5.2.50.0020.02710.68
5.2.40.0070.02510.62
5.2.30.0020.03210.58
5.2.20.0040.03110.60
5.2.10.0030.02410.52
5.2.00.0050.01410.46
5.1.60.0020.02310.07
5.1.50.0030.01310.13
5.1.40.0060.02110.08
5.1.30.0040.01310.28
5.1.20.0110.02510.26
5.1.10.0060.01210.11
5.1.00.0050.01210.13
5.0.50.0020.0149.40
5.0.40.0030.0129.28
5.0.30.0020.0339.24
5.0.20.0000.0229.19
5.0.10.0030.0179.21
5.0.00.0020.0329.17
4.4.90.0010.0139.08
4.4.80.0020.0089.08
4.4.70.0020.0189.08
4.4.60.0030.0159.08
4.4.50.0030.0099.08
4.4.40.0030.0129.08
4.4.30.0000.0149.08
4.4.20.0020.0149.08
4.4.10.0070.0139.08
4.4.00.0000.0219.08
4.3.110.0050.0159.08
4.3.100.0000.0169.08
4.3.90.0030.0199.08
4.3.80.0020.0129.08
4.3.70.0000.0159.08
4.3.60.0000.0129.08
4.3.50.0030.0089.08
4.3.40.0030.0259.08
4.3.30.0030.0089.08
4.3.20.0010.0109.08
4.3.10.0020.0189.08
4.3.00.0020.0149.08

preferences:
47.63 ms | 401 KiB | 5 Q