3v4l.org

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

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

End of function base64encode

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

End of function randbuffer

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.52 ms | 1400 KiB | 19 Q