3v4l.org

run code in 300+ PHP versions simultaneously
<?php function groupBySameLetters(array $words): array { $groups = []; foreach ($words as $word) { $letters = mb_str_split($word); sort($letters); $key = implode('', $letters); $groups[$key][] = $word; } return array_values($groups); } // Приклад використання: $input = ['ab', 'ac', 'ba', 'ca']; $result = groupBySameLetters($input); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/16OCX
function name:  (null)
number of ops:  9
compiled vars:  !0 = $input, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'groupbysameletters'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   22     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function groupbysameletters:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/16OCX
function name:  groupBySameLetters
number of ops:  28
compiled vars:  !0 = $words, !1 = $groups, !2 = $word, !3 = $letters, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    7     2      > FE_RESET_R                                       $6      !0, ->20
          3    > > FE_FETCH_R                                               $6, !2, ->20
    8     4    >   INIT_FCALL                                               'mb_str_split'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !3, $7
    9     8        INIT_FCALL                                               'sort'
          9        SEND_REF                                                 !3
         10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'implode'
         12        SEND_VAL                                                 ''
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !4, $10
   12    16        FETCH_DIM_W                                      $12     !1, !4
         17        ASSIGN_DIM                                               $12
         18        OP_DATA                                                  !2
    7    19      > JMP                                                      ->3
         20    >   FE_FREE                                                  $6
   15    21        INIT_FCALL                                               'array_values'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                         $14     
         24        VERIFY_RETURN_TYPE                                       $14
         25      > RETURN                                                   $14
   16    26*       VERIFY_RETURN_TYPE                                       
         27*     > RETURN                                                   null

End of function groupbysameletters

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.49 ms | 1022 KiB | 19 Q