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; $groups[$key] ++; } 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/vapPb
function name:  (null)
number of ops:  9
compiled vars:  !0 = $input, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL                                               'groupbysameletters'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   23     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 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/vapPb
function name:  groupBySameLetters
number of ops:  30
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, ->22
          3    > > FE_FETCH_R                                               $6, !2, ->22
    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
   13    19        FETCH_DIM_RW                                     $14     !1, !4
         20        PRE_INC                                                  $14
    7    21      > JMP                                                      ->3
         22    >   FE_FREE                                                  $6
   16    23        INIT_FCALL                                               'array_values'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $16     
         26        VERIFY_RETURN_TYPE                                       $16
         27      > RETURN                                                   $16
   17    28*       VERIFY_RETURN_TYPE                                       
         29*     > RETURN                                                   null

End of function groupbysameletters

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.44 ms | 1022 KiB | 19 Q