3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printCharMostRepeated($str) { if (!empty($str)) { $max = 0; foreach (count_chars($str, 1) as $key => $val) if ($max < $val) { $max = $val; $i = 0; unset($letter); $letter[$i++] = chr($key); } else if ($max == $val) $letter[$i++] = chr($key); if (count($letter) === 1) echo 'The character the most repeated is "'.$letter[0].'"'; else if (count($letter) > 1) { echo 'The characters the most repeated are : '; $count = count($letter); foreach ($letter as $key => $value) { echo '"'.$value.'"'; echo ($key === $count - 1) ? '.': ', '; } } } else echo 'value passed to '.__FUNCTION__.' can\'t be empty'; } $str = 'ddaabbccccsdfefffffqqqqqqdddaaa'; printCharMostRepeated($str);

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.5.30.0110.00718.38
8.5.20.0220.00918.34
8.5.10.0240.00616.61
8.5.00.0250.00818.17
8.4.180.0250.00819.72
8.4.170.0220.01021.62
8.4.160.0230.00921.20
8.4.150.0170.00616.90
8.4.140.0250.00817.60
8.4.130.0180.00817.58
8.4.120.0220.00720.01
8.4.110.0260.00920.09
8.4.100.0260.00817.72
8.4.90.0290.00918.11
8.4.80.0250.00618.67
8.4.70.0220.00717.79
8.4.60.0250.00918.13
8.4.50.0160.01018.39
8.4.40.0270.00417.63
8.4.30.0190.00618.53
8.4.20.0140.00517.88
8.4.10.0210.00518.26
8.3.300.0270.00819.50
8.3.290.0210.01119.40
8.3.280.0250.00718.43
8.3.270.0220.01016.47
8.3.260.0250.00316.61
8.3.250.0230.00817.83
8.3.240.0230.00816.65
8.3.230.0190.00816.64
8.3.220.0240.00716.87
8.3.210.0240.00717.39
8.3.200.0210.00616.61
8.3.190.0230.00816.72
8.3.180.0200.00716.82
8.3.170.0240.00616.51
8.3.160.0230.00816.49
8.3.150.0210.00816.71
8.3.140.0250.00617.12
8.3.130.0190.00317.26
8.3.120.0160.00717.80
8.3.110.0180.00417.90
8.3.100.0190.00716.54
8.3.90.0210.00817.04
8.3.80.0200.00717.39
8.3.70.0220.00616.67
8.3.60.0250.00417.11
8.3.50.0200.00520.55
8.3.40.0200.00718.54
8.3.30.0180.00418.05
8.3.20.0150.00619.91
8.3.10.0160.00619.94
8.3.00.0110.00420.53
8.2.300.0250.00919.02
8.2.290.0200.00818.57
8.2.280.0200.00716.43
8.2.270.0140.00716.45
8.2.260.0160.00517.36
8.2.250.0170.00416.46
8.2.240.0180.00417.24
8.2.230.0200.00518.39
8.2.220.0160.00918.97
8.2.210.0190.00619.91
8.2.200.0170.00516.61
8.2.190.0160.00916.59
8.2.180.0170.00719.79
8.2.170.0180.00818.20
8.2.160.0200.00519.51
8.2.150.0180.00420.50
8.2.140.0180.00420.05
8.2.130.0180.00720.46
8.2.120.0180.00620.58
8.2.110.0160.00518.63
8.2.100.0170.00517.96
8.2.90.0190.00817.69
8.2.80.0200.00418.05
8.2.70.0160.00617.63
8.2.60.0210.00617.56
8.2.50.0160.00817.74
8.2.40.0200.00518.43
8.2.30.0200.00617.83
8.2.20.0200.00517.68
8.2.10.0140.00618.16
8.2.00.0150.00618.21
8.1.340.0210.01017.57
8.1.330.0230.00819.05
8.1.320.0220.00516.15
8.1.310.0180.00716.96
8.1.300.0210.00416.24
8.1.290.0160.00617.01
8.1.280.0170.00719.32
8.1.270.0180.00319.65
8.1.260.0140.00621.05
8.1.250.0160.00521.02
8.1.240.0140.00819.07
8.1.230.0170.00618.59
8.1.220.0150.00617.80
8.1.210.0160.00517.85
8.1.200.0150.00617.50
8.1.190.0160.00517.36
8.1.180.0130.00817.86
8.1.170.0150.00617.86
8.1.160.0170.00417.91
8.1.150.0150.00517.96
8.1.140.0150.00417.90
8.1.130.0160.00418.36
8.1.120.0150.00717.53
8.1.110.0160.00617.48
8.1.100.0200.00617.51
8.1.90.0150.00717.55
8.1.80.0190.00417.50
8.1.70.0200.00617.51
8.1.60.0170.00617.65
8.1.50.0170.00517.55
8.1.40.0130.00617.55
8.1.30.0130.00817.68
8.1.20.0210.00717.64
8.1.10.0180.00617.54
8.1.00.0180.00617.50
8.0.300.0170.00617.40
8.0.290.0190.00716.71
8.0.280.0170.00617.33
8.0.270.0150.00517.06
8.0.260.0160.00417.24
8.0.250.0140.00516.89
8.0.240.0130.00616.96
8.0.230.0160.00616.78
8.0.220.0150.00516.77
8.0.210.0150.00416.85
8.0.200.0130.00616.95
8.0.190.0150.00516.82
8.0.180.0160.00616.78
8.0.170.0190.00716.88
8.0.160.0160.00816.81
8.0.150.0180.00716.83
8.0.140.0170.01016.74
8.0.130.0190.00615.65
8.0.120.0190.00716.83
8.0.110.0180.00616.82
8.0.100.0200.00516.75
8.0.90.0150.00616.78
8.0.80.0170.00916.82
8.0.70.0200.00716.80
8.0.60.0210.00716.77
8.0.50.0150.00816.76
8.0.30.0150.00716.85
8.0.20.0160.00817.00
8.0.10.0150.00516.89
8.0.00.0180.00616.76
7.4.330.0140.00516.24
7.4.320.0170.00516.44
7.4.300.0180.00516.61
7.4.290.0190.00416.49
7.4.280.0210.00516.50
7.4.270.0160.00616.49
7.4.260.0170.00516.38
7.4.250.0210.00416.40
7.4.240.0160.00616.49
7.4.230.0170.00416.40
7.4.220.0120.00416.52
7.4.210.0110.00916.52
7.4.200.0160.00316.52
7.4.190.0230.00916.40
7.4.180.0220.00516.59
7.4.160.0190.00716.57
7.4.150.0220.00416.47
7.4.140.0220.00716.26
7.4.130.0150.00716.44
7.4.120.0190.00616.30
7.4.110.0150.00816.48
7.4.100.0170.00616.51
7.4.90.0130.01016.37
7.4.80.0180.00416.30
7.4.70.0180.00716.49
7.4.60.0210.00416.47
7.4.50.0160.00716.41
7.4.40.0150.00816.43
7.4.30.0140.01016.55
7.4.20.0140.00816.35
7.4.10.0170.00516.52
7.4.00.0170.00716.40
7.3.330.0140.00416.23
7.3.320.0150.00415.19
7.3.310.0150.00316.21
7.3.300.0150.00416.29
7.3.290.0130.00616.38
7.3.280.0180.00716.16
7.3.270.0130.00416.32
7.3.260.0170.00516.48
7.3.250.0180.00516.34
7.3.240.0190.00916.31
7.3.230.0200.00416.31
7.3.220.0170.00816.23
7.3.210.0180.00816.31
7.3.200.0150.00716.39
7.3.190.0150.01016.33
7.3.180.0170.00816.30
7.3.170.0150.00716.31
7.3.160.0130.00816.30
7.3.150.0150.01016.26
7.3.140.0140.00716.25
7.3.130.0150.00816.29
7.3.120.0150.00616.17
7.3.110.0150.00616.29
7.3.100.0170.00616.29
7.3.90.0160.00516.44
7.3.80.0150.00716.36
7.3.70.0190.00216.39
7.3.60.0150.00616.39
7.3.50.0140.00616.30
7.3.40.0150.00616.34
7.3.30.0150.00816.38
7.3.20.0180.00816.95
7.3.10.0170.00717.01
7.3.00.0160.00516.92
7.2.340.0200.00316.33
7.2.330.0170.00716.30
7.2.320.0190.00716.43
7.2.310.0190.00516.32
7.2.300.0180.00616.30
7.2.290.0160.00816.49
7.2.280.0150.00916.51
7.2.270.0180.00716.59
7.2.260.0150.00816.43
7.2.250.0140.00516.42
7.2.240.0120.00816.39
7.2.230.0200.00716.47
7.2.220.0180.00616.43
7.2.210.0140.00816.45
7.2.200.0100.00716.50
7.2.190.0120.00716.56
7.2.180.0170.00716.38
7.2.170.0160.01016.58
7.2.160.0160.00616.58
7.2.150.0180.00717.17
7.2.140.0180.00517.16
7.2.130.0340.00717.27
7.2.120.0160.00717.14
7.2.110.0160.00717.20
7.2.100.0160.00717.25
7.2.90.0130.00817.19
7.2.80.0140.00917.11
7.2.70.0170.00517.09
7.2.60.0160.00717.17
7.2.50.0170.00617.16
7.2.40.0280.00817.25
7.2.30.0130.00917.17
7.2.20.0190.00417.25
7.2.10.0180.00617.19
7.2.00.0170.00717.27

preferences:
46.22 ms | 1518 KiB | 5 Q