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)); sort($unique_elements); $percentage_data = []; $total = count($array); foreach($unique_elements as $index => $element){ $current_percentage = $freq_data[$element] / $total; $percentage_data[$element] = $index > 0 ? $percentage_data[$prev_element] + $current_percentage : $current_percentage; $prev_element = $element; } 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.0080.00717.76
8.4.120.0140.00620.59
8.4.110.0120.00918.86
8.4.100.0110.00417.66
8.4.90.0050.00520.54
8.4.80.0110.00718.87
8.4.70.0040.00517.95
8.4.60.0120.00818.79
8.4.50.0050.00520.45
8.4.40.0100.01018.01
8.4.30.0070.01318.61
8.4.20.0030.01617.86
8.4.10.0030.00618.80
8.3.250.0050.00418.98
8.3.240.0120.00816.74
8.3.230.0080.01116.69
8.3.220.0060.00118.88
8.3.210.0140.00516.51
8.3.200.0110.00516.81
8.3.190.0120.00717.03
8.3.180.0040.00517.02
8.3.170.0040.01418.74
8.3.160.0110.00717.26
8.3.150.0090.00617.17
8.3.140.0180.00016.59
8.3.130.0090.00018.38
8.3.120.0100.00020.67
8.3.110.0060.00320.94
8.3.100.0120.00618.42
8.3.90.0050.00326.77
8.3.80.0000.00916.38
8.3.70.0120.00916.50
8.3.60.0180.00318.36
8.3.50.0090.00924.47
8.3.40.0070.01418.72
8.3.30.0190.00018.84
8.3.20.0080.00021.89
8.3.10.0000.00820.16
8.3.00.0000.00823.66
8.2.290.0140.00516.54
8.2.280.0050.00418.42
8.2.270.0150.00417.42
8.2.260.0040.00416.65
8.2.250.0050.00318.65
8.2.240.0040.00417.17
8.2.230.0090.00022.58
8.2.220.0000.00824.06
8.2.210.0100.00726.77
8.2.200.0050.00516.75
8.2.190.0000.01516.58
8.2.180.0040.01416.50
8.2.170.0070.00722.96
8.2.160.0100.00322.21
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0080.00020.92
8.2.110.0060.00320.40
8.2.100.0040.00817.84
8.2.90.0030.00619.48
8.2.80.0040.00418.05
8.2.70.0050.00317.75
8.2.60.0040.00417.63
8.2.50.0080.00018.05
8.2.40.0080.00019.88
8.2.30.0080.00018.14
8.2.20.0030.00618.13
8.2.10.0040.00419.38
8.2.00.0000.00719.36
8.1.330.0090.01016.24
8.1.320.0140.00616.42
8.1.310.0090.00016.98
8.1.300.0090.00020.01
8.1.290.0040.00430.84
8.1.280.0110.00425.92
8.1.270.0070.00024.66
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0060.00323.96
8.1.230.0080.00418.97
8.1.220.0080.00017.78
8.1.210.0000.00818.77
8.1.200.0100.00017.35
8.1.190.0060.00317.23
8.1.180.0050.00318.10
8.1.170.0040.00417.62
8.1.160.0000.00818.91
8.1.150.0000.00818.87
8.1.140.0030.00518.90
8.1.130.0040.00417.51
8.1.120.0030.00317.47
8.1.110.0000.00817.37
8.1.100.0080.00017.36
8.1.90.0030.00317.36
8.1.80.0000.00817.43
8.1.70.0040.00417.36
8.1.60.0000.00817.59
8.1.50.0040.00417.55
8.1.40.0000.00817.57
8.1.30.0030.00517.65
8.1.20.0040.00417.57
8.1.10.0050.00317.46
8.1.00.0000.00817.54
8.0.300.0000.00721.59
8.0.290.0000.00716.71
8.0.280.0040.00418.46
8.0.270.0080.00018.02
8.0.260.0040.00416.89
8.0.250.0070.00016.94
8.0.240.0000.00616.97
8.0.230.0070.00017.01
8.0.220.0030.00316.84
8.0.210.0030.00316.91
8.0.200.0070.00017.00
8.0.190.0000.00716.80
8.0.180.0000.00816.80
8.0.170.0080.00016.94
8.0.160.0040.00416.89
8.0.150.0040.00416.93
8.0.140.0030.00516.72
8.0.130.0030.00313.35
8.0.120.0040.00416.89
8.0.110.0040.00416.89
8.0.100.0000.00716.97
8.0.90.0030.00616.79
8.0.80.0080.01216.87
8.0.70.0040.00417.02
8.0.60.0070.00017.00
8.0.50.0030.00316.72
8.0.30.0130.00317.16
8.0.20.0100.01217.06
8.0.10.0000.00816.85
8.0.00.0060.01216.95
7.4.330.0020.00215.55
7.4.320.0000.00716.54
7.4.300.0000.00616.52
7.4.290.0040.00416.62
7.4.280.0030.00516.52
7.4.270.0060.00016.43
7.4.260.0030.00313.21
7.4.250.0030.00316.55
7.4.240.0050.00316.53
7.4.230.0000.00816.68
7.4.220.0040.00316.61
7.4.210.0080.00816.58
7.4.200.0030.00316.43
7.4.130.0120.00516.53
7.4.120.0150.00416.45
7.4.110.0140.00716.42
7.4.100.0080.00816.47
7.4.90.0090.00816.50
7.4.80.0080.01119.39
7.4.70.0060.01016.63
7.4.60.0030.01316.45
7.4.50.0030.01416.51
7.4.40.0060.01016.01
7.4.30.0110.00816.18
7.4.20.0070.01416.39
7.4.10.0070.01016.27
7.4.00.0120.00616.46
7.3.330.0000.00716.38
7.3.320.0060.00013.25
7.3.310.0080.00016.28
7.3.300.0000.00816.41
7.3.290.0060.00816.36
7.3.280.0070.00716.33
7.3.260.0100.00716.56
7.3.240.0110.00616.45
7.3.230.0060.01316.60
7.3.210.0130.00316.44
7.3.200.0030.01316.31
7.3.190.0060.00916.46
7.3.180.0090.00616.30
7.3.170.0080.00816.47
7.3.160.0090.00916.07
7.3.150.0110.01416.06
7.3.140.0070.01316.50
7.3.130.0160.00716.21
7.3.120.0050.01116.31
7.3.110.0120.00816.26
7.3.100.0130.01016.04
7.3.90.0090.01416.20
7.3.80.0080.01116.24
7.3.70.0090.00916.21
7.3.60.0120.01216.27
7.3.50.0100.00716.40
7.3.40.0170.00316.05
7.3.30.0090.00616.22
7.3.20.0280.00616.18
7.3.10.0070.01416.23
7.3.00.0100.00616.29
7.2.330.0070.01016.79
7.2.320.0040.01716.68
7.2.310.0060.01016.80
7.2.300.0140.00716.81
7.2.290.0140.00616.43
7.2.280.0140.00916.41
7.2.270.0160.00816.50
7.2.260.0090.00916.57
7.2.250.0120.00516.55
7.2.240.0160.01416.40
7.2.230.0040.01616.45
7.2.220.0030.01616.34
7.2.210.0160.00516.26
7.2.200.0110.00716.35
7.2.190.0000.02216.25
7.2.180.0050.01116.35
7.2.170.0110.01116.29
7.2.160.0140.00316.46
7.2.150.0140.00416.36
7.2.140.0070.01016.37
7.2.130.0160.00616.49
7.2.120.0080.01316.51
7.2.110.0120.00616.38
7.2.100.0130.00616.52
7.2.90.0140.00616.64
7.2.80.0070.01316.49
7.2.70.0130.01016.51
7.2.60.0050.01216.66
7.2.50.0100.01016.40
7.2.40.0030.01416.43
7.2.30.0120.00816.54
7.2.20.0140.00616.55
7.2.10.0090.01016.33
7.2.00.0090.00916.64

preferences:
32.24 ms | 403 KiB | 5 Q