3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo generateKey(); function generateKey() { return base64encode(randBuffer(48)); } function base64encode($buf) { $enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; return $enc; } function randBuffer($n) { try { $buf = openssl_random_pseudo_bytes($n); } catch (Exception $e) { $buf = ""; for ($i = 0; $i < $n; $i++) { $buf .= ord(mt_rand(0, 255)); } } return $buf; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nCFlr
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'generateKey'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   24     3      > RETURN                                                   1

Function generatekey:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nCFlr
function name:  generateKey
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL_BY_NAME                                       'base64encode'
          1        INIT_FCALL_BY_NAME                                       'randBuffer'
          2        SEND_VAL_EX                                              48
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR_NO_REF_EX                                       $0
          5        DO_FCALL                                      0  $1      
          6      > RETURN                                                   $1
    7     7*     > RETURN                                                   null

End of function generatekey

Function base64encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nCFlr
function name:  base64encode
number of ops:  4
compiled vars:  !0 = $buf, !1 = $enc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN                                                   !1, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
   11     2      > RETURN                                                   !1
   12     3*     > RETURN                                                   null

End of function base64encode

Function randbuffer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/nCFlr
function name:  randBuffer
number of ops:  23
compiled vars:  !0 = $n, !1 = $buf, !2 = $e, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
          5      > JMP                                                      ->21
   17     6  E > > CATCH                                       last         'Exception'
   18     7    >   ASSIGN                                                   !1, ''
   19     8        ASSIGN                                                   !3, 0
          9      > JMP                                                      ->19
   20    10    >   INIT_FCALL                                               'ord'
         11        INIT_FCALL                                               'mt_rand'
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 255
         14        DO_ICALL                                         $8      
         15        SEND_VAR                                                 $8
         16        DO_ICALL                                         $9      
         17        ASSIGN_OP                                     8          !1, $9
   19    18        PRE_INC                                                  !3
         19    >   IS_SMALLER                                               !3, !0
         20      > JMPNZ                                                    ~12, ->10
   23    21    > > RETURN                                                   !1
   24    22*     > RETURN                                                   null

End of function randbuffer

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.41 ms | 1400 KiB | 17 Q