3v4l.org

run code in 300+ PHP versions simultaneously
<?php function count_char($str) { $chars = str_split($str); $char_counter = array(); foreach($chars as $char) { if (ctype_alpha($char)) { if (!isset($char_counter[$char])) { $char_counter[$char] = 1; } else { ++$char_counter[$char]; } } } ksort($char_counter); return $char_counter; } var_dump(count_char("Hello World"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vjv9X
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'count_char'
          2        SEND_VAL                                                 'Hello+World'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function count_char:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/Vjv9X
function name:  count_char
number of ops:  27
compiled vars:  !0 = $str, !1 = $chars, !2 = $char_counter, !3 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    5     5        ASSIGN                                                   !2, <array>
    6     6      > FE_RESET_R                                       $7      !1, ->21
          7    > > FE_FETCH_R                                               $7, !3, ->21
    7     8    >   INIT_FCALL                                               'ctype_alpha'
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $8      
         11      > JMPZ                                                     $8, ->20
    8    12    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !2, !3
         13        BOOL_NOT                                         ~10     ~9
         14      > JMPZ                                                     ~10, ->18
    9    15    >   ASSIGN_DIM                                               !2, !3
         16        OP_DATA                                                  1
         17      > JMP                                                      ->20
   11    18    >   FETCH_DIM_RW                                     $12     !2, !3
         19        PRE_INC                                                  $12
    6    20    > > JMP                                                      ->7
         21    >   FE_FREE                                                  $7
   15    22        INIT_FCALL                                               'ksort'
         23        SEND_REF                                                 !2
         24        DO_ICALL                                                 
   16    25      > RETURN                                                   !2
   17    26*     > RETURN                                                   null

End of function count_char

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.75 ms | 1403 KiB | 22 Q