3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generateRandomName($minLength, $maxLength, $alphaNumericOnly = false) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; if (!$alphaNumericOnly) $chars .= ' '; $randomString = ''; $length = mt_rand($minLength, $maxLength); for ($i = 0; $i < $length; $i++) { $randomString .= $chars[rand(0, strlen($chars) - 1)]; } return $randomString; } $time = microtime(true); $i=0; while($i < 10000) { $i++; generateRandomName(15, 25); } $time = microtime(true) - $time; echo 'took ' . number_format($time, 3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
Branch analysis from position: 6
filename:       /in/s2NcG
function name:  (null)
number of ops:  25
compiled vars:  !0 = $time, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
   19     4        ASSIGN                                                   !1, 0
   20     5      > JMP                                                      ->11
   22     6    >   PRE_INC                                                  !1
   23     7        INIT_FCALL                                               'generaterandomname'
          8        SEND_VAL                                                 15
          9        SEND_VAL                                                 25
         10        DO_FCALL                                      0          
   20    11    >   IS_SMALLER                                               !1, 10000
         12      > JMPNZ                                                    ~7, ->6
   27    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $8      
         16        SUB                                              ~9      $8, !0
         17        ASSIGN                                                   !0, ~9
   28    18        INIT_FCALL                                               'number_format'
         19        SEND_VAR                                                 !0
         20        SEND_VAL                                                 3
         21        DO_ICALL                                         $11     
         22        CONCAT                                           ~12     'took+', $11
         23        ECHO                                                     ~12
         24      > RETURN                                                   1

Function generaterandomname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 15
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 15
Branch analysis from position: 26
Branch analysis from position: 15
Branch analysis from position: 7
filename:       /in/s2NcG
function name:  generateRandomName
number of ops:  28
compiled vars:  !0 = $minLength, !1 = $maxLength, !2 = $alphaNumericOnly, !3 = $chars, !4 = $randomString, !5 = $length, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
    5     3        ASSIGN                                                   !3, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    6     4        BOOL_NOT                                         ~8      !2
          5      > JMPZ                                                     ~8, ->7
          6    >   ASSIGN_OP                                     8          !3, '+'
    7     7    >   ASSIGN                                                   !4, ''
    8     8        INIT_FCALL                                               'mt_rand'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $11     
         12        ASSIGN                                                   !5, $11
   10    13        ASSIGN                                                   !6, 0
         14      > JMP                                                      ->24
   12    15    >   INIT_FCALL                                               'rand'
         16        SEND_VAL                                                 0
         17        STRLEN                                           ~14     !3
         18        SUB                                              ~15     ~14, 1
         19        SEND_VAL                                                 ~15
         20        DO_ICALL                                         $16     
         21        FETCH_DIM_R                                      ~17     !3, $16
         22        ASSIGN_OP                                     8          !4, ~17
   10    23        PRE_INC                                                  !6
         24    >   IS_SMALLER                                               !6, !5
         25      > JMPNZ                                                    ~20, ->15
   15    26    > > RETURN                                                   !4
   16    27*     > RETURN                                                   null

End of function generaterandomname

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.22 ms | 1403 KiB | 22 Q