3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_password(int $min, int $max) { $allowed = array_merge( range(65, 90), range(97, 122) ); $length = random_int($min, $max); $chars = []; for ($i = 0; $i < $length; $i++) { $bi = random_int(0, count($allowed)-1); $chars[] = chr($allowed[$bi]); } return implode('', $chars); } var_dump(random_password(8, 12));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eOVZk
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'random_password'
          2        SEND_VAL                                                 8
          3        SEND_VAL                                                 12
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function random_password:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 23
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 23
Branch analysis from position: 39
Branch analysis from position: 23
filename:       /in/eOVZk
function name:  random_password
number of ops:  45
compiled vars:  !0 = $min, !1 = $max, !2 = $allowed, !3 = $length, !4 = $chars, !5 = $i, !6 = $bi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'array_merge'
    6     3        INIT_FCALL                                               'range'
          4        SEND_VAL                                                 65
          5        SEND_VAL                                                 90
          6        DO_ICALL                                         $7      
          7        SEND_VAR                                                 $7
    7     8        INIT_FCALL                                               'range'
          9        SEND_VAL                                                 97
         10        SEND_VAL                                                 122
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                         $9      
    5    14        ASSIGN                                                   !2, $9
   10    15        INIT_FCALL                                               'random_int'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !3, $11
   12    20        ASSIGN                                                   !4, <array>
   14    21        ASSIGN                                                   !5, 0
         22      > JMP                                                      ->37
   15    23    >   INIT_FCALL                                               'random_int'
         24        SEND_VAL                                                 0
         25        COUNT                                            ~15     !2
         26        SUB                                              ~16     ~15, 1
         27        SEND_VAL                                                 ~16
         28        DO_ICALL                                         $17     
         29        ASSIGN                                                   !6, $17
   16    30        INIT_FCALL                                               'chr'
         31        FETCH_DIM_R                                      ~20     !2, !6
         32        SEND_VAL                                                 ~20
         33        DO_ICALL                                         $21     
         34        ASSIGN_DIM                                               !4
         35        OP_DATA                                                  $21
   14    36        PRE_INC                                                  !5
         37    >   IS_SMALLER                                               !5, !3
         38      > JMPNZ                                                    ~23, ->23
   19    39    >   INIT_FCALL                                               'implode'
         40        SEND_VAL                                                 ''
         41        SEND_VAR                                                 !4
         42        DO_ICALL                                         $24     
         43      > RETURN                                                   $24
   20    44*     > RETURN                                                   null

End of function random_password

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.02 ms | 1403 KiB | 26 Q