3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generate_password($length = 8, $complex=3) { $min = "abcdefghijklmnopqrstuvwxyz"; $num = "0123456789"; $maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $symb = "!@#$%^&*()_-=+;:,.?"; $chars = $min; if ($complex >= 2) { $chars .= $num; } if ($complex >= 3) { $chars .= $maj; } if ($complex >= 4) { $chars .= $symb; } $password = substr( str_shuffle( $chars ), 0, $length ); return $password; } echo generate_password(8); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0EpOF
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'generate_password'
          1        SEND_VAL                                                 8
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   15     4      > RETURN                                                   1

Function generate_password:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 13
Branch analysis from position: 10
filename:       /in/0EpOF
function name:  generate_password
number of ops:  27
compiled vars:  !0 = $length, !1 = $complex, !2 = $min, !3 = $num, !4 = $maj, !5 = $symb, !6 = $chars, !7 = $password
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      8
          1        RECV_INIT                                        !1      3
    3     2        ASSIGN                                                   !2, 'abcdefghijklmnopqrstuvwxyz'
    4     3        ASSIGN                                                   !3, '0123456789'
    5     4        ASSIGN                                                   !4, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    6     5        ASSIGN                                                   !5, '%21%40%23%24%25%5E%26%2A%28%29_-%3D%2B%3B%3A%2C.%3F'
    7     6        ASSIGN                                                   !6, !2
    8     7        IS_SMALLER_OR_EQUAL                                      2, !1
          8      > JMPZ                                                     ~13, ->10
          9    >   ASSIGN_OP                                     8          !6, !3
    9    10    >   IS_SMALLER_OR_EQUAL                                      3, !1
         11      > JMPZ                                                     ~15, ->13
         12    >   ASSIGN_OP                                     8          !6, !4
   10    13    >   IS_SMALLER_OR_EQUAL                                      4, !1
         14      > JMPZ                                                     ~17, ->16
         15    >   ASSIGN_OP                                     8          !6, !5
   11    16    >   INIT_FCALL                                               'substr'
         17        INIT_FCALL                                               'str_shuffle'
         18        SEND_VAR                                                 !6
         19        DO_ICALL                                         $19     
         20        SEND_VAR                                                 $19
         21        SEND_VAL                                                 0
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $20     
         24        ASSIGN                                                   !7, $20
   12    25      > RETURN                                                   !7
   13    26*     > RETURN                                                   null

End of function generate_password

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.41 ms | 1398 KiB | 18 Q