3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo random_string(32,0,0); function random_string($charcount = 8, $mode = 0, $capsonly = 0) { /* 0 = alphanumeric 1 = letters only 2 = numbers only */ $chars_alpha_cap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $chars_alpha_low = 'abcdefghijklmnopqrstuvwxyz'; $chars_num = '0123456789'; if ($capsonly) { $chars_alpha_cap = ''; $chars_alpha_low = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; } switch ($mode) { case 1: $chars = $chars_alpha_cap . $chars_alpha_low; break; case 2: $chars = $chars_num; break; default: $chars = $chars_alpha_cap . $chars_alpha_low . $chars_num; } for ($i = 0; $i < $charcount; $i++) { $rand .= $chars[mt_rand(0, strlen($chars) - 1)]; } return $rand; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BFuDC
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL_BY_NAME                                       'random_string'
          1        SEND_VAL_EX                                              32
          2        SEND_VAL_EX                                              0
          3        SEND_VAL_EX                                              0
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
   34     6      > RETURN                                                   1

Function random_string:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 24
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 24
Branch analysis from position: 35
Branch analysis from position: 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 9
filename:       /in/BFuDC
function name:  random_string
number of ops:  37
compiled vars:  !0 = $charcount, !1 = $mode, !2 = $capsonly, !3 = $chars_alpha_cap, !4 = $chars_alpha_low, !5 = $chars_num, !6 = $chars, !7 = $i, !8 = $rand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV_INIT                                        !0      8
          1        RECV_INIT                                        !1      0
          2        RECV_INIT                                        !2      0
    8     3        ASSIGN                                                   !3, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    9     4        ASSIGN                                                   !4, 'abcdefghijklmnopqrstuvwxyz'
   10     5        ASSIGN                                                   !5, '0123456789'
   12     6      > JMPZ                                                     !2, ->9
   13     7    >   ASSIGN                                                   !3, ''
   14     8        ASSIGN                                                   !4, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
   18     9    >   IS_EQUAL                                                 !1, 1
         10      > JMPNZ                                                    ~14, ->14
   21    11    >   IS_EQUAL                                                 !1, 2
         12      > JMPNZ                                                    ~14, ->17
         13    > > JMP                                                      ->19
   19    14    >   CONCAT                                           ~15     !3, !4
         15        ASSIGN                                                   !6, ~15
   20    16      > JMP                                                      ->22
   22    17    >   ASSIGN                                                   !6, !5
   23    18      > JMP                                                      ->22
   25    19    >   CONCAT                                           ~18     !3, !4
         20        CONCAT                                           ~19     ~18, !5
         21        ASSIGN                                                   !6, ~19
   28    22    >   ASSIGN                                                   !7, 0
         23      > JMP                                                      ->33
   29    24    >   INIT_FCALL                                               'mt_rand'
         25        SEND_VAL                                                 0
         26        STRLEN                                           ~22     !6
         27        SUB                                              ~23     ~22, 1
         28        SEND_VAL                                                 ~23
         29        DO_ICALL                                         $24     
         30        FETCH_DIM_R                                      ~25     !6, $24
         31        ASSIGN_OP                                     8          !8, ~25
   28    32        PRE_INC                                                  !7
         33    >   IS_SMALLER                                               !7, !0
         34      > JMPNZ                                                    ~28, ->24
   32    35    > > RETURN                                                   !8
   34    36*     > RETURN                                                   null

End of function random_string

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.82 ms | 1392 KiB | 15 Q