3v4l.org

run code in 300+ PHP versions simultaneously
<?php function GeneratePassword ($length,$chars) { $res = array(); $char_length = strlen($chars); 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/8kpo0
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 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
Branch analysis from position: 7
filename:       /in/8kpo0
function name:  GeneratePassword
number of ops:  23
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        ASSIGN                                                   !3, ~6
    9     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->15
   11     7    >   INIT_FCALL                                               'rand'
          8        SEND_VAL                                                 0
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $10     
         11        FETCH_DIM_R                                      ~11     !1, $10
         12        ASSIGN_DIM                                               !2
         13        OP_DATA                                                  ~11
    9    14        PRE_INC                                                  !4
         15    >   IS_SMALLER                                               !4, !0
         16      > JMPNZ                                                    ~13, ->7
   14    17    >   INIT_FCALL                                               'implode'
         18        SEND_VAL                                                 ''
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $14     
         21      > RETURN                                                   $14
   15    22*     > RETURN                                                   null

End of function generatepassword

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.45 ms | 1399 KiB | 18 Q