3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen_token() { $chars = array_merge(range("z","a"), range("Z", "A"), range("0", "9")); //Define the array length here so we dont have to call count() on each iteration $chars_len = count($chars)-1; $token_len = 25; $token = ""; for($i = 0; $i<$token_len; $i++) { $token .= $chars[mt_rand(0, $chars_len)]; } return $token;; } print strlen(gen_token()) == 25; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/76QvU
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'gen_token'
          1        DO_FCALL                                      0  $0      
          2        STRLEN                                           ~1      $0
          3        IS_EQUAL                                         ~2      ~1, 25
          4        ECHO                                                     ~2
   19     5      > RETURN                                                   1

Function gen_token:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 25
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 25
Branch analysis from position: 34
Branch analysis from position: 25
filename:       /in/76QvU
function name:  gen_token
number of ops:  36
compiled vars:  !0 = $chars, !1 = $chars_len, !2 = $token_len, !3 = $token, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'array_merge'
          1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 'z'
          3        SEND_VAL                                                 'a'
          4        DO_ICALL                                         $5      
          5        SEND_VAR                                                 $5
          6        INIT_FCALL                                               'range'
          7        SEND_VAL                                                 'Z'
          8        SEND_VAL                                                 'A'
          9        DO_ICALL                                         $6      
         10        SEND_VAR                                                 $6
         11        INIT_FCALL                                               'range'
         12        SEND_VAL                                                 '0'
         13        SEND_VAL                                                 '9'
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !0, $8
    7    18        COUNT                                            ~10     !0
         19        SUB                                              ~11     ~10, 1
         20        ASSIGN                                                   !1, ~11
    8    21        ASSIGN                                                   !2, 25
   10    22        ASSIGN                                                   !3, ''
   12    23        ASSIGN                                                   !4, 0
         24      > JMP                                                      ->32
   13    25    >   INIT_FCALL                                               'mt_rand'
         26        SEND_VAL                                                 0
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $16     
         29        FETCH_DIM_R                                      ~17     !0, $16
         30        ASSIGN_OP                                     8          !3, ~17
   12    31        PRE_INC                                                  !4
         32    >   IS_SMALLER                                               !4, !2
         33      > JMPNZ                                                    ~20, ->25
   16    34    > > RETURN                                                   !3
   17    35*     > RETURN                                                   null

End of function gen_token

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.27 ms | 1403 KiB | 20 Q