3v4l.org

run code in 500+ PHP versions simultaneously
<?php // continuing with complex anagrams // if we have "babc" and we want a signature for this to get // --> [1, 2, 1, 0, 0, 0, ... , 0] function buildingSignature($input) { $signature = array_fill(0, 26, 0); $input = strtolower($input); for ($i = 0; $i < strlen($input); $i++) { $char = $input[$i]; $signature[ord($char) - ord('a')] += 1; } return $signature; } var_dump(buildingSignature("babc"));die;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 61) Position 1 = -2
filename:       /in/PWlRr
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_FCALL                                                   'buildingsignature'
          2        SEND_VAL                                                     'babc'
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        DO_ICALL                                                     
          6      > INIT_FCALL                                                   'exit'
          7*       DO_ICALL                                                     
   19     8*     > RETURN                                                       1

Function buildingsignature:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
Branch analysis from position: 13
filename:       /in/PWlRr
function name:  buildingSignature
number of ops:  27
compiled vars:  !0 = $input, !1 = $signature, !2 = $i, !3 = $char
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    9     1        INIT_FCALL                                                   'array_fill'
          2        SEND_VAL                                                     0
          3        SEND_VAL                                                     26
          4        SEND_VAL                                                     0
          5        DO_ICALL                                             $4      
          6        ASSIGN                                                       !1, $4
   10     7        INIT_FCALL                                                   'strtolower'
          8        SEND_VAR                                                     !0
          9        DO_ICALL                                             $6      
         10        ASSIGN                                                       !0, $6
   11    11        ASSIGN                                                       !2, 0
         12      > JMP                                                          ->22
   12    13    >   FETCH_DIM_R                                          ~9      !0, !2
         14        ASSIGN                                                       !3, ~9
   13    15        INIT_FCALL                                                   'ord'
         16        SEND_VAR                                                     !3
         17        DO_ICALL                                             $11     
         18        SUB                                                  ~12     $11, 97
         19        ASSIGN_DIM_OP                    +=               1          !1, ~12
         20        OP_DATA                                                      1
   11    21        PRE_INC                                                      !2
         22    >   STRLEN                                               ~15     !0
         23        IS_SMALLER                                                   !2, ~15
         24      > JMPNZ                                                        ~16, ->13
   15    25    > > RETURN                                                       !1
   16    26*     > RETURN                                                       null

End of function buildingsignature

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.21 ms | 1410 KiB | 19 Q