3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(6,8,9,8,9,8,5,4,4,9); function Counting($array){ $freq_data = array_count_values($array); $unique_elements = array_map('intval',array_keys($freq_data)); $min_element = min($unique_elements); $max_element = max($unique_elements); $percentage_data = []; $total = count($array); for($i = $min_element; $i <= $max_element ; ++$i){ $current_percentage = isset($freq_data[$i]) ? ($freq_data[$i] / $total) : 0; $percentage_data[$i] = $i > $min_element ? $percentage_data[$i-1] + $current_percentage : $current_percentage; } uksort($percentage_data,function($a,$b){ return strnatcmp($a,$b); });// just to be sure that associative hash keys are in ascending order return $percentage_data; } print_r(Counting($array));

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.4.130.0120.00817.40
8.4.120.0060.00520.95
8.4.110.0060.00518.65
8.4.100.0130.00817.90
8.4.90.0130.00818.87
8.4.80.0040.00418.62
8.4.70.0050.00319.55
8.4.60.0160.00424.22
8.4.50.0130.00918.55
8.4.40.0130.00717.83
8.4.30.0100.00718.91
8.4.20.0170.00318.00
8.4.10.0030.00618.68
8.3.260.0120.00816.48
8.3.250.0100.00817.21
8.3.240.0140.00518.14
8.3.230.0130.00716.51
8.3.220.0100.00719.04
8.3.210.0080.01118.43
8.3.200.0040.00516.46
8.3.190.0100.00917.24
8.3.180.0110.00816.50
8.3.170.0090.00617.05
8.3.160.0130.00616.59
8.3.150.0120.00818.54
8.3.140.0030.00516.96
8.3.130.0040.00418.34
8.3.120.0130.00720.68
8.3.110.0110.00020.94
8.3.100.0000.01018.30
8.3.90.0060.00326.77
8.3.80.0040.00816.63
8.3.70.0090.00616.63
8.3.60.0040.01118.43
8.3.50.0130.00724.53
8.3.40.0040.01118.85
8.3.30.0040.01118.89
8.3.20.0080.00021.95
8.3.10.0080.00022.10
8.3.00.0040.00423.36
8.2.290.0120.00720.63
8.2.280.0080.00718.50
8.2.270.0090.00917.19
8.2.260.0060.00316.81
8.2.250.0030.00716.66
8.2.240.0100.00717.32
8.2.230.0060.00322.58
8.2.220.0080.00024.06
8.2.210.0030.00626.77
8.2.200.0060.00316.63
8.2.190.0120.00616.75
8.2.180.0070.00725.92
8.2.170.0040.01118.86
8.2.160.0060.01022.96
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00421.01
8.2.110.0060.00319.39
8.2.100.0080.00417.91
8.2.90.0050.00319.20
8.2.80.0080.00017.97
8.2.70.0000.00917.63
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0000.00819.89
8.2.30.0040.00418.02
8.2.20.0070.00018.20
8.2.10.0000.00719.28
8.2.00.0070.00019.32
8.1.330.0110.00922.07
8.1.320.0100.00216.05
8.1.310.0100.00018.29
8.1.300.0100.00717.97
8.1.290.0040.00430.84
8.1.280.0110.01125.92
8.1.270.0040.00422.19
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0090.00023.83
8.1.230.0110.00017.64
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0030.00618.10
8.1.170.0080.00418.50
8.1.160.0050.00318.81
8.1.150.0000.00718.95
8.1.140.0050.00218.81
8.1.130.0000.00717.38
8.1.120.0050.00217.37
8.1.110.0040.00317.50
8.1.100.0030.00517.44
8.1.90.0000.00817.47
8.1.80.0050.00317.44
8.1.70.0000.00717.36
8.1.60.0040.00417.52
8.1.50.0000.00817.46
8.1.40.0050.00317.52
8.1.30.0080.00017.59
8.1.20.0080.00017.65
8.1.10.0060.00317.59
8.1.00.0080.00017.48
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0070.00018.43
8.0.270.0030.00317.93
8.0.260.0030.00316.83
8.0.250.0070.00016.95
8.0.240.0070.00016.98
8.0.230.0070.00016.85
8.0.220.0040.00416.87
8.0.210.0060.00016.83
8.0.200.0070.00016.95
8.0.190.0000.00717.00
8.0.180.0040.00416.92
8.0.170.0040.00416.85
8.0.160.0000.00716.88
8.0.150.0040.00416.80
8.0.140.0030.00616.87
8.0.130.0030.00313.37
8.0.120.0060.00316.82
8.0.110.0000.00716.96
8.0.100.0050.00316.88
8.0.90.0040.00416.85
8.0.80.0060.01216.93
8.0.70.0030.00516.81
8.0.60.0040.00416.75
8.0.50.0030.00516.76
8.0.30.0140.00317.10
8.0.20.0120.00817.11
8.0.10.0060.00316.98
8.0.00.0090.00916.84
7.4.330.0000.00515.55
7.4.320.0030.00316.61
7.4.300.0000.00716.58
7.4.290.0050.00316.49
7.4.280.0080.00016.40
7.4.270.0000.00616.51
7.4.260.0000.00513.22
7.4.250.0040.00416.61
7.4.240.0020.00516.51
7.4.230.0040.00416.44
7.4.220.0030.00316.68
7.4.210.0120.00716.65
7.4.200.0000.00716.49
7.4.130.0120.00816.45
7.4.120.0070.01016.49
7.4.110.0150.00416.70
7.4.100.0090.01216.59
7.4.90.0140.00316.43
7.4.80.0090.01519.39
7.4.70.0090.00916.67
7.4.60.0180.00016.46
7.4.50.0030.01416.48
7.4.40.0100.01116.54
7.4.30.0140.01416.29
7.4.20.0070.01116.49
7.4.10.0090.00916.26
7.4.00.0140.00416.42
7.3.330.0070.00016.18
7.3.320.0030.00313.19
7.3.310.0000.00716.27
7.3.300.0070.00016.39
7.3.290.0070.00816.36
7.3.280.0060.01516.37
7.3.260.0130.00716.72
7.3.240.0080.01016.54
7.3.230.0060.01016.61
7.3.210.0040.01216.36
7.3.200.0100.00716.68
7.3.190.0150.00016.30
7.3.180.0130.00316.51
7.3.170.0100.00716.35
7.3.160.0090.00916.43
7.3.150.0100.01016.30
7.3.140.0140.00316.45
7.3.130.0050.01416.38
7.3.120.0120.00916.51
7.3.110.0150.00616.59
7.3.100.0160.00716.32
7.3.90.0090.01316.59
7.3.80.0100.00616.39
7.3.70.0040.01216.53
7.3.60.0090.01216.50
7.3.50.0030.01816.38
7.3.40.0070.01416.30
7.3.30.0060.01016.47
7.3.20.0110.00816.46
7.3.10.0170.00716.44
7.3.00.0070.01016.25
7.2.330.0080.01516.82
7.2.320.0040.01216.75
7.2.310.0070.01016.83
7.2.300.0120.01216.48
7.2.290.0100.01016.86
7.2.280.0080.01216.81
7.2.270.0090.00916.71
7.2.260.0070.01116.75
7.2.250.0130.00516.87
7.2.240.0130.00816.81
7.2.230.0190.00516.78
7.2.220.0080.01516.54
7.2.210.0060.01216.43
7.2.200.0140.00716.57
7.2.190.0150.00716.54
7.2.180.0070.01416.50
7.2.170.0120.01216.47
7.2.160.0090.00916.64
7.2.150.0100.00716.61
7.2.140.0130.00916.59
7.2.130.0030.01416.72
7.2.120.0130.00316.62
7.2.110.0130.00416.64
7.2.100.0090.00916.68
7.2.90.0000.01816.74
7.2.80.0160.00516.52
7.2.70.0060.01216.51
7.2.60.0090.01016.72
7.2.50.0070.01116.67
7.2.40.0150.00416.88
7.2.30.0140.00316.87
7.2.20.0150.00916.63
7.2.10.0120.01216.68
7.2.00.0030.01516.59

preferences:
30.18 ms | 403 KiB | 5 Q