3v4l.org

run code in 300+ PHP versions simultaneously
<?php $words=['MVW','MWAH','MWAH','MYW','MW','MY9AH','MYQAH','MYQAH','MY9AH','MYQAH', 'MYQAH','MWAH','MYQAH','MYSWI','MYQAH','MYQAH','MW','MW','MW','MW']; echo "*** Step #1: Replace each word with an array of its characters ***\n"; var_export(array_map('str_split',$words)); echo "\n\n---\n\n"; echo "*** Step #2: Pass the characters through array_map with the splat operator and func_get_args() to isolate columnar data including NULLs where no character exists in the column ***\n"; var_export(array_map(function(){return func_get_args();},...array_map('str_split',$words))); echo "\n\n---\n\n"; echo "*** Step #3: Convert column data to strings with the added benefit of eliminating NULLs ***\n"; //var_export(array_map(function(){return implode(func_get_args());},...array_map('str_split',$words))); echo "\n\n---\n\n"; echo "*** Step #4: Count the occurrences of each character; stored as ord values as keys, and occurrences as values ***\n"; var_export(array_map(function(){return count_chars(implode(func_get_args()),1);},...array_map('str_split',$words))); echo "\n\n---\n\n"; echo "*** Step #5: Sort DESC while preserving keys ***\n"; var_export(array_map(function(){$occurrences=count_chars(implode(func_get_args()),1); arsort($occurrences); return $occurrences;},...array_map('str_split',$words))); echo "\n\n---\n\n"; echo "*** Step #6: Target the first (highest occurring) value/character in the array ***\n"; var_export(array_map(function(){$occurrences=count_chars(implode(func_get_args()),1); arsort($occurrences); return key($occurrences);},...array_map('str_split',$words))); echo "\n\n---\n\n"; echo "*** Step #7: Convert the targeted character from ord() to chr() ***\n"; var_export(array_map(function(){$occurrences=count_chars(implode(func_get_args()),1); arsort($occurrences); return chr(key($occurrences));},...array_map('str_split',$words)));

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.70.0110.00416.63
8.3.60.0080.00818.55
8.3.50.0100.00519.23
8.3.40.0060.01018.59
8.3.30.0070.00718.59
8.3.20.0080.00021.73
8.3.10.0040.00423.60
8.3.00.0000.00819.67
8.2.190.0120.00616.58
8.2.180.0240.00025.92
8.2.170.0130.00718.61
8.2.160.0100.00722.96
8.2.150.0070.00025.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00420.91
8.2.110.0000.01122.28
8.2.100.0060.00617.91
8.2.90.0000.00817.75
8.2.80.0040.00418.64
8.2.70.0040.00418.03
8.2.60.0100.00018.04
8.2.50.0060.00318.10
8.2.40.0000.00720.61
8.2.30.0000.00719.29
8.2.20.0080.00018.15
8.2.10.0070.00318.13
8.2.00.0050.00218.26
8.1.280.0120.00625.92
8.1.270.0000.00724.02
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0060.00322.00
8.1.230.0040.00817.77
8.1.220.0060.00317.74
8.1.210.0000.00818.77
8.1.200.0000.01117.35
8.1.190.0060.00317.36
8.1.180.0000.01018.10
8.1.170.0040.00418.50
8.1.160.0040.00418.92
8.1.150.0040.00420.37
8.1.140.0000.00717.60
8.1.130.0040.00419.07
8.1.120.0030.00517.41
8.1.110.0000.00817.42
8.1.100.0040.00417.38
8.1.90.0000.00817.54
8.1.80.0050.00317.39
8.1.70.0040.00417.49
8.1.60.0000.01017.68
8.1.50.0000.00817.56
8.1.40.0060.00317.39
8.1.30.0090.00317.52
8.1.20.0000.00817.61
8.1.10.0080.00017.58
8.1.00.0000.00817.47
8.0.300.0000.00718.77
8.0.290.0000.00816.75
8.0.280.0000.00718.35
8.0.270.0040.00417.30
8.0.260.0030.00316.83
8.0.250.0030.00517.03
8.0.240.0000.00816.95
8.0.230.0070.00017.01
8.0.220.0040.00416.88
8.0.210.0040.00417.03
8.0.200.0030.00317.00
8.0.190.0040.00416.98
8.0.180.0080.00016.84
8.0.170.0060.00316.98
8.0.160.0090.00016.95
8.0.150.0040.00416.94
8.0.140.0040.00416.86
8.0.130.0030.00313.36
8.0.120.0040.00416.95
8.0.110.0000.00716.95
8.0.100.0000.00717.04
8.0.90.0000.00716.75
8.0.80.0100.01016.98
8.0.70.0040.00416.97
8.0.60.0000.00816.83
8.0.50.0050.00216.95
8.0.30.0080.01217.05
8.0.20.0150.00417.40
8.0.10.0040.00417.00
8.0.00.0050.01216.89
7.4.330.0000.00515.55
7.4.320.0000.00616.60
7.4.300.0040.00416.48
7.4.290.0070.00016.61
7.4.280.0070.00016.62
7.4.270.0040.00416.53
7.4.260.0000.00716.66
7.4.250.0000.00716.60
7.4.240.0070.00016.63
7.4.230.0040.00416.61
7.4.220.0040.00416.38
7.4.210.0010.01516.57
7.4.200.0070.00016.34
7.4.160.0100.00816.56
7.4.150.0130.00517.40
7.4.140.0090.00917.86
7.4.130.0070.01116.52
7.4.120.0080.01016.48
7.4.110.0120.00816.65
7.4.100.0070.01716.50
7.4.90.0210.00316.62
7.4.80.0100.01319.39
7.4.70.0120.00616.62
7.4.60.0100.00716.43
7.4.50.0040.01516.35
7.4.40.0080.00816.56
7.4.00.0000.01415.15
7.3.330.0030.00313.28
7.3.320.0000.00513.10
7.3.310.0030.00516.27
7.3.300.0030.00316.29
7.3.290.0040.00416.32
7.3.280.0040.01216.23
7.3.270.0040.01517.40
7.3.260.0080.01016.20
7.3.240.0070.01116.27
7.3.230.0080.00816.25
7.3.210.0090.00916.51
7.3.200.0100.00616.36
7.3.190.0090.01216.24
7.3.180.0080.00816.40
7.3.170.0070.01016.48
7.3.160.0060.01316.46
7.2.330.0130.00716.67
7.2.320.0050.01316.62
7.2.310.0120.01416.73
7.2.300.0080.01516.68
7.2.290.0000.01916.63
7.2.60.0070.01016.90
7.2.20.0100.01319.83
7.2.10.0090.01419.84
7.2.00.0110.00919.93
7.1.200.0060.00615.84
7.1.140.0080.01418.72
7.1.130.0100.00918.50
7.1.120.0070.01318.68
7.1.110.0050.01418.08
7.1.100.0090.00817.84
7.1.90.0130.01118.03
7.1.80.0100.01217.95
7.1.70.0060.01616.96
7.1.60.0250.01135.14
7.1.50.0290.01734.44
7.1.40.0250.01734.25
7.1.30.0240.01334.55
7.1.20.0300.01534.64
7.1.10.0070.01416.48
7.1.00.0090.01316.79

preferences:
29.59 ms | 401 KiB | 5 Q