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; } $ret .= $chars[$byte % $strlen]; if (strlen($ret) >= $strlen) { return $ret; } } } echo password();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KZ8h6
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     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 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 12
Branch analysis from position: 31
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 = 30
Branch analysis from position: 30
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/KZ8h6
function name:  password
number of ops:  32
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                                                      ->30
   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                                                      ->30
   15    23    >   MOD                                              ~19     !5, !3
         24        FETCH_DIM_R                                      ~20     !2, ~19
         25        ASSIGN_OP                                     8          !1, ~20
   16    26        STRLEN                                           ~22     !1
         27        IS_SMALLER_OR_EQUAL                                      !3, ~22
         28      > JMPZ                                                     ~23, ->30
   17    29    > > RETURN                                                   !1
         30    > > JMPNZ                                                    <true>, ->12
   20    31    > > RETURN                                                   null

End of function password

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.12 ms | 1403 KiB | 18 Q