3v4l.org

run code in 300+ PHP versions simultaneously
<?php function password($len = 12) { $ret = ''; $chars = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'; $strlen = strlen($chars); $cutoff = floor(256 / $strlen) * $strlen; for (;;) { $byte = ord(openssl_random_pseudo_bytes(1)[0]); if ($byte >= $cutoff) { continue; } echo $strlen; echo ($byte % $strlen).PHP_EOL; $ret .= $chars[$byte % $strlen]; if (strlen($ret) >= $len) { return $ret; } } } echo password();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZraiH
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     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 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 12
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 34
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/ZraiH
function name:  password
number of ops:  36
compiled vars:  !0 = $len, !1 = $ret, !2 = $chars, !3 = $strlen, !4 = $cutoff, !5 = $byte
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      12
    4     1        ASSIGN                                                   !1, ''
    5     2        ASSIGN                                                   !2, 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'
    6     3        STRLEN                                           ~8      !2
          4        ASSIGN                                                   !3, ~8
    7     5        INIT_FCALL                                               'floor'
          6        DIV                                              ~10     256, !3
          7        SEND_VAL                                                 ~10
          8        DO_ICALL                                         $11     
          9        MUL                                              ~12     !3, $11
         10        ASSIGN                                                   !4, ~12
    9    11      > JMP                                                      ->34
   10    12    >   INIT_FCALL                                               'ord'
         13        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
         14        SEND_VAL_EX                                              1
         15        DO_FCALL                                      0  $14     
         16        FETCH_DIM_R                                      ~15     $14, 0
         17        SEND_VAL                                                 ~15
         18        DO_ICALL                                         $16     
         19        ASSIGN                                                   !5, $16
   11    20        IS_SMALLER_OR_EQUAL                                      !4, !5
         21      > JMPZ                                                     ~18, ->23
   12    22    > > JMP                                                      ->34
   15    23    >   ECHO                                                     !3
   16    24        MOD                                              ~19     !5, !3
         25        CONCAT                                           ~20     ~19, '%0A'
         26        ECHO                                                     ~20
   18    27        MOD                                              ~21     !5, !3
         28        FETCH_DIM_R                                      ~22     !2, ~21
         29        ASSIGN_OP                                     8          !1, ~22
   19    30        STRLEN                                           ~24     !1
         31        IS_SMALLER_OR_EQUAL                                      !0, ~24
         32      > JMPZ                                                     ~25, ->34
   20    33    > > RETURN                                                   !1
         34    > > JMPNZ                                                    <true>, ->12
   23    35    > > RETURN                                                   null

End of function password

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.09 ms | 1403 KiB | 18 Q