3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mt_rand_str ($l, $c = '1234567890') { for ($s = '', $cl = strlen($c)-1, $i = 0; $i < $l; $s .= $c[mt_rand(0, $cl)], ++$i); return $s; } echo mt_rand_str(8); // Something like mp2tmpsw echo mt_rand_str(4, '0123456789'); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FYj8M
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'mt_rand_str'
          1        SEND_VAL                                                 8
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
    9     4        INIT_FCALL                                               'mt_rand_str'
          5        SEND_VAL                                                 4
          6        SEND_VAL                                                 '0123456789'
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
   11     9      > RETURN                                                   1

Function mt_rand_str:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
Branch analysis from position: 8
filename:       /in/FYj8M
function name:  mt_rand_str
number of ops:  19
compiled vars:  !0 = $l, !1 = $c, !2 = $s, !3 = $cl, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      '1234567890'
    4     2        ASSIGN                                                   !2, ''
          3        STRLEN                                           ~6      !1
          4        SUB                                              ~7      ~6, 1
          5        ASSIGN                                                   !3, ~7
          6        ASSIGN                                                   !4, 0
          7      > JMP                                                      ->15
          8    >   INIT_FCALL                                               'mt_rand'
          9        SEND_VAL                                                 0
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $10     
         12        FETCH_DIM_R                                      ~11     !1, $10
         13        ASSIGN_OP                                     8          !2, ~11
         14        PRE_INC                                                  !4
         15    >   IS_SMALLER                                               !4, !0
         16      > JMPNZ                                                    ~14, ->8
    5    17    > > RETURN                                                   !2
    6    18*     > RETURN                                                   null

End of function mt_rand_str

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.55 ms | 1398 KiB | 17 Q