3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getRandomStr($length){ return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length); } $start = microtime(true); // Mixed could theoretically be an object or an array. // In this example it's an array. $mixed = array(); for($i = 0; $i < 100; $i++) { if (is_array($mixed)) { $mixed[getRandomStr(15)] = 'abcd'; } else { // Do something else which we don't care about here } } print round(microtime(true) - $start, 2) . 's';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
Branch analysis from position: 7
Branch analysis from position: 15
filename:       /in/3RhBM
function name:  (null)
number of ops:  29
compiled vars:  !0 = $start, !1 = $mixed, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !0, $3
   12     4        ASSIGN                                                   !1, <array>
   13     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->16
   14     7    >   TYPE_CHECK                                  128          !1
          8      > JMPZ                                                     ~7, ->15
   15     9    >   INIT_FCALL                                               'getrandomstr'
         10        SEND_VAL                                                 15
         11        DO_FCALL                                      0  $8      
         12        ASSIGN_DIM                                               !1, $8
         13        OP_DATA                                                  'abcd'
         14      > JMP                                                      ->15
   13    15    >   PRE_INC                                                  !2
         16    >   IS_SMALLER                                               !2, 100
         17      > JMPNZ                                                    ~11, ->7
   22    18    >   INIT_FCALL                                               'round'
         19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $12     
         22        SUB                                              ~13     $12, !0
         23        SEND_VAL                                                 ~13
         24        SEND_VAL                                                 2
         25        DO_ICALL                                         $14     
         26        CONCAT                                           ~15     $14, 's'
         27        ECHO                                                     ~15
         28      > RETURN                                                   1

Function getrandomstr:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3RhBM
function name:  getRandomStr
number of ops:  11
compiled vars:  !0 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'substr'
          2        INIT_FCALL                                               'str_shuffle'
          3        SEND_VAL                                                 '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
          4        DO_ICALL                                         $1      
          5        SEND_VAR                                                 $1
          6        SEND_VAL                                                 0
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $2      
          9      > RETURN                                                   $2
    5    10*     > RETURN                                                   null

End of function getrandomstr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.14 ms | 1402 KiB | 22 Q