3v4l.org

run code in 300+ PHP versions simultaneously
<?php function randomPassword() { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; $pass = array(); //remember to declare $pass as an array $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache for ($i = 0; $i < 8; $i++) { $n = rand(0, $alphaLength); $pass[] = $alphabet[$n]; } return implode($pass); //turn the array into a string } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/38j0W
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   1

Function randompassword:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
Branch analysis from position: 7
filename:       /in/38j0W
function name:  randomPassword
number of ops:  23
compiled vars:  !0 = $alphabet, !1 = $pass, !2 = $alphaLength, !3 = $i, !4 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789'
    4     1        ASSIGN                                                   !1, <array>
    5     2        STRLEN                                           ~7      !0
          3        SUB                                              ~8      ~7, 1
          4        ASSIGN                                                   !2, ~8
    6     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->16
    7     7    >   INIT_FCALL                                               'rand'
          8        SEND_VAL                                                 0
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !4, $11
    8    12        FETCH_DIM_R                                      ~14     !0, !4
         13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  ~14
    6    15        PRE_INC                                                  !3
         16    >   IS_SMALLER                                               !3, 8
         17      > JMPNZ                                                    ~16, ->7
   10    18    >   INIT_FCALL                                               'implode'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $17     
         21      > RETURN                                                   $17
   11    22*     > RETURN                                                   null

End of function randompassword

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.85 ms | 1396 KiB | 17 Q