3v4l.org

run code in 300+ PHP versions simultaneously
<?php function randomString($length, $chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") { $length = min($length, 255); $string = ''; while (strlen($string) < $length) { $string .= $chars[mt_rand(0, strlen($chars)-1)]; } return $string; } echo randomString(10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcIn
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'randomstring'
          1        SEND_VAL                                                 10
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

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

End of function randomstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.47 ms | 1399 KiB | 18 Q