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']; $chars=array_map('str_split',$words); usort($chars,function($a,$b){return sizeof($b)-sizeof($a);}); $result=''; foreach($chars[0] as $col=>$not_used){ $occurrences=array_count_values(array_column($chars,$col)); // no NULL values arsort($occurrences); $result.=key($occurrences); } echo $result;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 32
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 32
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/Djm47
function name:  (null)
number of ops:  35
compiled vars:  !0 = $words, !1 = $chars, !2 = $result, !3 = $not_used, !4 = $col, !5 = $occurrences
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'array_map'
          2        SEND_VAL                                                 'str_split'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    6     6        INIT_FCALL                                               'usort'
          7        SEND_REF                                                 !1
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDjm47%3A6%240'
          9        SEND_VAL                                                 ~9
         10        DO_ICALL                                                 
    8    11        ASSIGN                                                   !2, ''
    9    12        FETCH_DIM_R                                      ~12     !1, 0
         13      > FE_RESET_R                                       $13     ~12, ->32
         14    > > FE_FETCH_R                                       ~14     $13, !3, ->32
         15    >   ASSIGN                                                   !4, ~14
   10    16        INIT_FCALL                                               'array_count_values'
         17        INIT_FCALL                                               'array_column'
         18        SEND_VAR                                                 !1
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                         $16     
         21        SEND_VAR                                                 $16
         22        DO_ICALL                                         $17     
         23        ASSIGN                                                   !5, $17
   11    24        INIT_FCALL                                               'arsort'
         25        SEND_REF                                                 !5
         26        DO_ICALL                                                 
   12    27        INIT_FCALL                                               'key'
         28        SEND_VAR                                                 !5
         29        DO_ICALL                                         $20     
         30        ASSIGN_OP                                     8          !2, $20
    9    31      > JMP                                                      ->14
         32    >   FE_FREE                                                  $13
   14    33        ECHO                                                     !2
   15    34      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FDjm47%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Djm47
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        COUNT                                            ~2      !1
          3        COUNT                                            ~3      !0
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FDjm47%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
129.49 ms | 1405 KiB | 25 Q