3v4l.org

run code in 300+ PHP versions simultaneously
<?php function randomString($length = 6) { $pre = $suf = ""; $characters = array_merge(range('a','z'), range('0','9')); $max = count($characters) - 1; for ($i = 0; $i < $length; $i++) { $rand = mt_rand(0, $max); $pre .= $characters[$rand]; $rand = mt_rand(0, $max); $suf .= $characters[$rand]; } return $pre . time() . $suf; } echo randomString();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CoKif
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'randomstring'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function randomstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 21
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 21
Branch analysis from position: 38
Branch analysis from position: 21
filename:       /in/CoKif
function name:  randomString
number of ops:  44
compiled vars:  !0 = $length, !1 = $pre, !2 = $suf, !3 = $characters, !4 = $max, !5 = $i, !6 = $rand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      6
    4     1        ASSIGN                                           ~7      !2, ''
          2        ASSIGN                                                   !1, ~7
    5     3        INIT_FCALL                                               'array_merge'
          4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 'a'
          6        SEND_VAL                                                 'z'
          7        DO_ICALL                                         $9      
          8        SEND_VAR                                                 $9
          9        INIT_FCALL                                               'range'
         10        SEND_VAL                                                 '0'
         11        SEND_VAL                                                 '9'
         12        DO_ICALL                                         $10     
         13        SEND_VAR                                                 $10
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !3, $11
    6    16        COUNT                                            ~13     !3
         17        SUB                                              ~14     ~13, 1
         18        ASSIGN                                                   !4, ~14
    8    19        ASSIGN                                                   !5, 0
         20      > JMP                                                      ->36
    9    21    >   INIT_FCALL                                               'mt_rand'
         22        SEND_VAL                                                 0
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                         $17     
         25        ASSIGN                                                   !6, $17
   10    26        FETCH_DIM_R                                      ~19     !3, !6
         27        ASSIGN_OP                                     8          !1, ~19
   12    28        INIT_FCALL                                               'mt_rand'
         29        SEND_VAL                                                 0
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                         $21     
         32        ASSIGN                                                   !6, $21
   13    33        FETCH_DIM_R                                      ~23     !3, !6
         34        ASSIGN_OP                                     8          !2, ~23
    8    35        PRE_INC                                                  !5
         36    >   IS_SMALLER                                               !5, !0
         37      > JMPNZ                                                    ~26, ->21
   15    38    >   INIT_FCALL                                               'time'
         39        DO_ICALL                                         $27     
         40        CONCAT                                           ~28     !1, $27
         41        CONCAT                                           ~29     ~28, !2
         42      > RETURN                                                   ~29
   16    43*     > RETURN                                                   null

End of function randomstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.8 ms | 1403 KiB | 22 Q