3v4l.org

run code in 300+ PHP versions simultaneously
<?php function password($len = 12) { $chars = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'; $len = strlen($chars); $cutoff = floor(256 / $len) * $len; for (;;) { $byte = ord(openssl_random_pseudo_bytes(1)[0]); if ($byte >= $cutoff) { continue; } return $byte % $len; } } echo password();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pJgo7
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'password'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function password:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 11
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pJgo7
function name:  password
number of ops:  26
compiled vars:  !0 = $len, !1 = $chars, !2 = $cutoff, !3 = $byte
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      12
    4     1        ASSIGN                                                   !1, 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'
    5     2        STRLEN                                           ~5      !1
          3        ASSIGN                                                   !0, ~5
    6     4        INIT_FCALL                                               'floor'
          5        DIV                                              ~7      256, !0
          6        SEND_VAL                                                 ~7
          7        DO_ICALL                                         $8      
          8        MUL                                              ~9      !0, $8
          9        ASSIGN                                                   !2, ~9
    8    10      > JMP                                                      ->24
    9    11    >   INIT_FCALL                                               'ord'
         12        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
         13        SEND_VAL_EX                                              1
         14        DO_FCALL                                      0  $11     
         15        FETCH_DIM_R                                      ~12     $11, 0
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                         $13     
         18        ASSIGN                                                   !3, $13
   10    19        IS_SMALLER_OR_EQUAL                                      !2, !3
         20      > JMPZ                                                     ~15, ->22
   11    21    > > JMP                                                      ->24
   14    22    >   MOD                                              ~16     !3, !0
         23      > RETURN                                                   ~16
         24    > > JMPNZ                                                    <true>, ->11
   16    25    > > RETURN                                                   null

End of function password

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.63 ms | 1399 KiB | 18 Q