3v4l.org

run code in 300+ PHP versions simultaneously
<?php function randomString($length = 6) { $str = ""; $characters = array_merge(range('a','z'), range('0','9')); $max = count($characters) - 1; for ($i = 0; $i < $length; $i++) { $rand = mt_rand(0, $max); $str .= $characters[$rand]; } return $str . time(); } echo randomString();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/huJvI
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     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 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 20
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 20
Branch analysis from position: 30
Branch analysis from position: 20
filename:       /in/huJvI
function name:  randomString
number of ops:  35
compiled vars:  !0 = $length, !1 = $str, !2 = $characters, !3 = $max, !4 = $i, !5 = $rand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      6
    4     1        ASSIGN                                                   !1, ''
    5     2        INIT_FCALL                                               'array_merge'
          3        INIT_FCALL                                               'range'
          4        SEND_VAL                                                 'a'
          5        SEND_VAL                                                 'z'
          6        DO_ICALL                                         $7      
          7        SEND_VAR                                                 $7
          8        INIT_FCALL                                               'range'
          9        SEND_VAL                                                 '0'
         10        SEND_VAL                                                 '9'
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !2, $9
    6    15        COUNT                                            ~11     !2
         16        SUB                                              ~12     ~11, 1
         17        ASSIGN                                                   !3, ~12
    8    18        ASSIGN                                                   !4, 0
         19      > JMP                                                      ->28
    9    20    >   INIT_FCALL                                               'mt_rand'
         21        SEND_VAL                                                 0
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !5, $15
         25        FETCH_DIM_R                                      ~17     !2, !5
         26        ASSIGN_OP                                     8          !1, ~17
    8    27        PRE_INC                                                  !4
         28    >   IS_SMALLER                                               !4, !0
         29      > JMPNZ                                                    ~20, ->20
   11    30    >   INIT_FCALL                                               'time'
         31        DO_ICALL                                         $21     
         32        CONCAT                                           ~22     !1, $21
         33      > RETURN                                                   ~22
   12    34*     > RETURN                                                   null

End of function randomstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.78 ms | 1394 KiB | 22 Q