3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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]; } echo implode($pass); //turn the array into a string
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/9mSm0
function name:  (null)
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
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789'
    3     1        ASSIGN                                                   !1, <array>
    4     2        STRLEN                                           ~7      !0
          3        SUB                                              ~8      ~7, 1
          4        ASSIGN                                                   !2, ~8
    5     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->16
    6     7    >   INIT_FCALL                                               'rand'
          8        SEND_VAL                                                 0
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !4, $11
    7    12        FETCH_DIM_R                                      ~14     !0, !4
         13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  ~14
    5    15        PRE_INC                                                  !3
         16    >   IS_SMALLER                                               !3, 8
         17      > JMPNZ                                                    ~16, ->7
    9    18    >   INIT_FCALL                                               'implode'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $17     
         21        ECHO                                                     $17
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.24 ms | 1395 KiB | 17 Q