3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Copyright By http://www.latestcode.net */ class PHP_Password_Generator{ public $password_length; public $password; private $numbers; private $alphabetic_chars; private $special_chars; private $password_type; public function __construct($type){ $this->password_type = $type; $this->numbers='0123456789'; $this->alphabetic_chars='abcdefghijklmnopqrstuvwxyz'; $this->special_chars='@#$%&!'; } /* Generate Password */ public function generate_password($length=8){ $this->password_length = ($length<1?8:$length); $this->password=''; switch($this->password_type){ default:{//Letters $password_characters = $this->alphabetic_chars; }break; } $password_characters = str_split($password_characters); shuffle($password_characters); for($i=0;$i<$this->password_length;$i++){ $this->password.=$password_characters[rand(0,count($password_characters)-1)]; } return $this->password; } /* Add custom special characters to the password */ public function set_special_characters($special_chars){ $this->special_chars = $special_chars; } } //Example 4: $pwd = new PHP_Password_Generator(4);//Make list of passwords for($x=0;$x<1358;$x++){ echo $pwd->generate_password(8).'<br/>'; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
Branch analysis from position: 6
filename:       /in/ngQel
function name:  (null)
number of ops:  15
compiled vars:  !0 = $pwd, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   NEW                                              $2      'PHP_Password_Generator'
          1        SEND_VAL_EX                                              4
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   49     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->12
   50     6    >   INIT_METHOD_CALL                                         !0, 'generate_password'
          7        SEND_VAL_EX                                              8
          8        DO_FCALL                                      0  $6      
          9        CONCAT                                           ~7      $6, '%3Cbr%2F%3E'
         10        ECHO                                                     ~7
   49    11        PRE_INC                                                  !1
         12    >   IS_SMALLER                                               !1, 1358
         13      > JMPNZ                                                    ~9, ->6
   51    14    > > RETURN                                                   1

Class PHP_Password_Generator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ngQel
function name:  __construct
number of ops:  10
compiled vars:  !0 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        ASSIGN_OBJ                                               'password_type'
          2        OP_DATA                                                  !0
   16     3        ASSIGN_OBJ                                               'numbers'
          4        OP_DATA                                                  '0123456789'
   17     5        ASSIGN_OBJ                                               'alphabetic_chars'
          6        OP_DATA                                                  'abcdefghijklmnopqrstuvwxyz'
   18     7        ASSIGN_OBJ                                               'special_chars'
          8        OP_DATA                                                  '%40%23%24%25%26%21'
   19     9      > RETURN                                                   null

End of function __construct

Function generate_password:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 25
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 25
Branch analysis from position: 38
Branch analysis from position: 25
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
filename:       /in/ngQel
function name:  generate_password
number of ops:  41
compiled vars:  !0 = $length, !1 = $password_characters, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV_INIT                                        !0      8
   24     1        IS_SMALLER                                               !0, 1
          2      > JMPZ                                                     ~4, ->5
          3    >   QM_ASSIGN                                        ~5      8
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~5      !0
          6    >   ASSIGN_OBJ                                               'password_length'
          7        OP_DATA                                                  ~5
   25     8        ASSIGN_OBJ                                               'password'
          9        OP_DATA                                                  ''
   26    10        FETCH_OBJ_R                                      ~7      'password_type'
         11      > JMP                                                      ->12
   28    12    >   FETCH_OBJ_R                                      ~9      'alphabetic_chars'
         13        ASSIGN                                                   !1, ~9
   29    14      > JMP                                                      ->15
         15    >   FREE                                                     ~7
   31    16        INIT_FCALL                                               'str_split'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !1, $11
   32    20        INIT_FCALL                                               'shuffle'
         21        SEND_REF                                                 !1
         22        DO_ICALL                                                 
   34    23        ASSIGN                                                   !2, 0
         24      > JMP                                                      ->35
   35    25    >   INIT_FCALL                                               'rand'
         26        SEND_VAL                                                 0
         27        COUNT                                            ~16     !1
         28        SUB                                              ~17     ~16, 1
         29        SEND_VAL                                                 ~17
         30        DO_ICALL                                         $18     
         31        FETCH_DIM_R                                      ~19     !1, $18
         32        ASSIGN_OBJ_OP                                 8          'password'
         33        OP_DATA                                                  ~19
   34    34        PRE_INC                                                  !2
         35    >   FETCH_OBJ_R                                      ~21     'password_length'
         36        IS_SMALLER                                               !2, ~21
         37      > JMPNZ                                                    ~22, ->25
   37    38    >   FETCH_OBJ_R                                      ~23     'password'
         39      > RETURN                                                   ~23
   38    40*     > RETURN                                                   null

End of function generate_password

Function set_special_characters:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ngQel
function name:  set_special_characters
number of ops:  4
compiled vars:  !0 = $special_chars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   43     1        ASSIGN_OBJ                                               'special_chars'
          2        OP_DATA                                                  !0
   44     3      > RETURN                                                   null

End of function set_special_characters

End of class PHP_Password_Generator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.24 ms | 1404 KiB | 19 Q