3v4l.org

run code in 300+ PHP versions simultaneously
<?php $assoc = count_chars('hello', 1); var_export( array_reduce( array_keys($assoc), fn ($result, $k) => $result += [chr($k) => $assoc[$k]], [] ) ); var_export( array_count_values(str_split('hello')) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q2aQq
function name:  (null)
number of ops:  28
compiled vars:  !0 = $assoc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'count_chars'
          1        SEND_VAL                                                 'hello'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
    4     5        INIT_FCALL                                               'var_export'
    5     6        INIT_FCALL                                               'array_reduce'
    6     7        INIT_FCALL                                               'array_keys'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
    7    11        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
         12        BIND_LEXICAL                                             ~4, !0
         13        SEND_VAL                                                 ~4
    8    14        SEND_VAL                                                 <array>
    5    15        DO_ICALL                                         $5      
    8    16        SEND_VAR                                                 $5
    4    17        DO_ICALL                                                 
   12    18        INIT_FCALL                                               'var_export'
   13    19        INIT_FCALL                                               'array_count_values'
         20        INIT_FCALL                                               'str_split'
         21        SEND_VAL                                                 'hello'
         22        DO_ICALL                                         $7      
         23        SEND_VAR                                                 $7
         24        DO_ICALL                                         $8      
         25        SEND_VAR                                                 $8
   12    26        DO_ICALL                                                 
   14    27      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q2aQq
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $result, !1 = $k, !2 = $assoc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        INIT_FCALL                                               'chr'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        FETCH_DIM_R                                      ~4      !2, !1
          7        INIT_ARRAY                                       ~5      ~4, $3
          8        ASSIGN_OP                                     1  ~6      !0, ~5
          9      > RETURN                                                   ~6
         10*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.93 ms | 1018 KiB | 20 Q