3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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
Jump found. Position 1 = 18
Branch analysis from position: 18
Jump found. Position 1 = 20, Position 2 = 8
Branch analysis from position: 20
Jump found. Position 1 = -2
Branch analysis from position: 8
Jump found. Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
Jump found. Position 1 = 16
Branch analysis from position: 16
Jump found. Position 1 = 20, Position 2 = 8
Branch analysis from position: 20
Branch analysis from position: 8
Branch analysis from position: 16
filename:       /in/3RhBM
function name:  (null)
number of ops:  31
compiled vars:  !0 = $start, !1 = $mixed, !2 = $i
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
   8     1        INIT_FCALL                                               'microtime'
         2        SEND_VAL                                                 <true>
         3        DO_ICALL                                         $3      
         4        ASSIGN                                                   !0, $3
  12     5        ASSIGN                                                   !1, <array>
  13     6        ASSIGN                                                   !2, 0
         7      > JMP                                                      ->18
  14     8    >   TYPE_CHECK                                    7  ~7      !1
         9      > JMPZ                                                     ~7, ->16
  15    10    >   INIT_FCALL                                               'getrandomstr'
        11        SEND_VAL                                                 15
        12        DO_FCALL                                      0  $8      
        13        ASSIGN_DIM                                               !1, $8
        14        OP_DATA                                                  'abcd'
        15      > JMP                                                      ->16
  13    16    >   POST_INC                                         ~10     !2
        17        FREE                                                     ~10
        18    >   IS_SMALLER                                       ~11     !2, 100
        19      > JMPNZ                                                    ~11, ->8
  22    20    >   INIT_FCALL                                               'round'
        21        INIT_FCALL                                               'microtime'
        22        SEND_VAL                                                 <true>
        23        DO_ICALL                                         $12     
        24        SUB                                              ~13     $12, !0
        25        SEND_VAL                                                 ~13
        26        SEND_VAL                                                 2
        27        DO_ICALL                                         $14     
        28        CONCAT                                           ~15     $14, 's'
        29        ECHO                                                     ~15
        30      > RETURN                                                   1

Function getrandomstr:
Finding entry points
Branch analysis from position: 0
Jump found. 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 7.2.0