3v4l.org

run code in 300+ PHP versions simultaneously
<?php function GeneratePassword ($length,$chars) { $res = array(); $char_length = strlen($chars) - 1; for($i = 0; $i < $length; $i++) { $res[] = $chars[rand(0,$char_length)]; } return implode('', $res); } echo GeneratePassword(10, 'asdafdfgsaffhdhsd');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1dn2a
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'generatepassword'
          1        SEND_VAL                                                 10
          2        SEND_VAL                                                 'asdafdfgsaffhdhsd'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function generatepassword:
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 = 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
Branch analysis from position: 8
filename:       /in/1dn2a
function name:  GeneratePassword
number of ops:  24
compiled vars:  !0 = $length, !1 = $chars, !2 = $res, !3 = $char_length, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !2, <array>
    7     3        STRLEN                                           ~6      !1
          4        SUB                                              ~7      ~6, 1
          5        ASSIGN                                                   !3, ~7
    9     6        ASSIGN                                                   !4, 0
          7      > JMP                                                      ->16
   11     8    >   INIT_FCALL                                               'rand'
          9        SEND_VAL                                                 0
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $11     
         12        FETCH_DIM_R                                      ~12     !1, $11
         13        ASSIGN_DIM                                               !2
         14        OP_DATA                                                  ~12
    9    15        PRE_INC                                                  !4
         16    >   IS_SMALLER                                               !4, !0
         17      > JMPNZ                                                    ~14, ->8
   14    18    >   INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 ''
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $15     
         22      > RETURN                                                   $15
   15    23*     > RETURN                                                   null

End of function generatepassword

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.64 ms | 1399 KiB | 18 Q