3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!defined('PHP_EOL')) { define('PHP_EOL', "\r\n"); } for ($count = 0; $count < 100; $count++) { // generate the 32bit byte array (if you have the "openssl_random_pseudo_bytes" function available) if (function_exists('openssl_random_pseudo_bytes')) { $random_key = openssl_random_pseudo_bytes(32); } else { // this is the longer way to do it... $random_key = ''; for( $i = 0; $i < 64; $i++) { $random_key .= chr(mt_rand(65, 90)); } $random_key = hexdec($random_key); } // this is it as hex print "Hex key: " . bin2hex($random_key) . PHP_EOL; print PHP_EOL; // this is the base64 string that you want to save print "Save this string: " . base64_encode($random_key) . PHP_EOL; print PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 1, Position 2 = 5
Branch analysis from position: 1
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 7
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 7
Branch analysis from position: 51
Branch analysis from position: 7
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 19
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 7
Branch analysis from position: 51
Branch analysis from position: 7
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 19
Branch analysis from position: 30
Branch analysis from position: 19
Branch analysis from position: 5
filename:       /in/slj8E
function name:  (null)
number of ops:  52
compiled vars:  !0 = $count, !1 = $random_key, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > JMPZ                                                     <false>, ->5
    4     1    >   INIT_FCALL                                               'define'
          2        SEND_VAL                                                 'PHP_EOL'
          3        SEND_VAL                                                 '%0D%0A'
          4        DO_ICALL                                                 
    7     5    >   ASSIGN                                                   !0, 0
          6      > JMP                                                      ->49
    9     7    >   INIT_FCALL                                               'function_exists'
          8        SEND_VAL                                                 'openssl_random_pseudo_bytes'
          9        DO_ICALL                                         $5      
         10      > JMPZ                                                     $5, ->16
   10    11    >   INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
         12        SEND_VAL_EX                                              32
         13        DO_FCALL                                      0  $6      
         14        ASSIGN                                                   !1, $6
         15      > JMP                                                      ->34
   13    16    >   ASSIGN                                                   !1, ''
   14    17        ASSIGN                                                   !2, 0
         18      > JMP                                                      ->28
   15    19    >   INIT_FCALL                                               'chr'
         20        INIT_FCALL                                               'mt_rand'
         21        SEND_VAL                                                 65
         22        SEND_VAL                                                 90
         23        DO_ICALL                                         $10     
         24        SEND_VAR                                                 $10
         25        DO_ICALL                                         $11     
         26        ASSIGN_OP                                     8          !1, $11
   14    27        PRE_INC                                                  !2
         28    >   IS_SMALLER                                               !2, 64
         29      > JMPNZ                                                    ~14, ->19
   17    30    >   INIT_FCALL                                               'hexdec'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $15     
         33        ASSIGN                                                   !1, $15
   21    34    >   INIT_FCALL                                               'bin2hex'
         35        SEND_VAR                                                 !1
         36        DO_ICALL                                         $17     
         37        CONCAT                                           ~18     'Hex+key%3A+', $17
         38        CONCAT                                           ~19     ~18, '%0A'
         39        ECHO                                                     ~19
   23    40        ECHO                                                     '%0A'
   26    41        INIT_FCALL                                               'base64_encode'
         42        SEND_VAR                                                 !1
         43        DO_ICALL                                         $20     
         44        CONCAT                                           ~21     'Save+this+string%3A+', $20
         45        CONCAT                                           ~22     ~21, '%0A'
         46        ECHO                                                     ~22
   28    47        ECHO                                                     '%0A'
    7    48        PRE_INC                                                  !0
         49    >   IS_SMALLER                                               !0, 100
         50      > JMPNZ                                                    ~24, ->7
   29    51    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.07 ms | 1400 KiB | 27 Q