3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tstart = microtime(true); $numberOfRandoms = 5000; $uniques = array(); do { $uniques[''.mt_rand(10000, 99999)] = true; } while(count(array_keys($uniques)) < $numberOfRandoms); $uniques = array_keys($uniques); $elapsed = microtime(true) - $tstart; echo "hek2mgl:\t\t\t" . $elapsed . PHP_EOL; $tstart = microtime(true); $uniques = range(10000, 99999); shuffle($uniques); $uniques = array_slice($uniques, 0, $numberOfRandoms); $elapsed = microtime(true) - $tstart; echo "Dave Chen:\t\t\t" . $elapsed . PHP_EOL; $tstart = microtime(true); $uniques = array(); for($i = 0; $i < $numberOfRandoms; $i++) { do { $code = mt_rand(10000, 99999); } while(in_array($code, $uniques)); $uniques[] = $code; } $elapsed = microtime(true) - $tstart; echo "Josh from Qaribou:\t\t" . $elapsed . PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 6
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 64
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 64
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 64
Branch analysis from position: 79
Branch analysis from position: 64
Branch analysis from position: 64
Branch analysis from position: 6
filename:       /in/eeHON
function name:  (null)
number of ops:  88
compiled vars:  !0 = $tstart, !1 = $numberOfRandoms, !2 = $uniques, !3 = $elapsed, !4 = $i, !5 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $6      
          3        ASSIGN                                                   !0, $6
    6     4        ASSIGN                                                   !1, 5000
    8     5        ASSIGN                                                   !2, <array>
   10     6    >   INIT_FCALL                                               'mt_rand'
          7        SEND_VAL                                                 10000
          8        SEND_VAL                                                 99999
          9        DO_ICALL                                         $10     
         10        CONCAT                                           ~11     '', $10
         11        ASSIGN_DIM                                               !2, ~11
         12        OP_DATA                                                  <true>
   11    13        INIT_FCALL                                               'array_keys'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $13     
         16        COUNT                                            ~14     $13
         17        IS_SMALLER                                               ~14, !1
         18      > JMPNZ                                                    ~15, ->6
   13    19    >   INIT_FCALL                                               'array_keys'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $16     
         22        ASSIGN                                                   !2, $16
   15    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $18     
         26        SUB                                              ~19     $18, !0
         27        ASSIGN                                                   !3, ~19
   16    28        CONCAT                                           ~21     'hek2mgl%3A%09%09%09', !3
         29        CONCAT                                           ~22     ~21, '%0A'
         30        ECHO                                                     ~22
   19    31        INIT_FCALL                                               'microtime'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $23     
         34        ASSIGN                                                   !0, $23
   21    35        INIT_FCALL                                               'range'
         36        SEND_VAL                                                 10000
         37        SEND_VAL                                                 99999
         38        DO_ICALL                                         $25     
         39        ASSIGN                                                   !2, $25
   22    40        INIT_FCALL                                               'shuffle'
         41        SEND_REF                                                 !2
         42        DO_ICALL                                                 
   23    43        INIT_FCALL                                               'array_slice'
         44        SEND_VAR                                                 !2
         45        SEND_VAL                                                 0
         46        SEND_VAR                                                 !1
         47        DO_ICALL                                         $28     
         48        ASSIGN                                                   !2, $28
   27    49        INIT_FCALL                                               'microtime'
         50        SEND_VAL                                                 <true>
         51        DO_ICALL                                         $30     
         52        SUB                                              ~31     $30, !0
         53        ASSIGN                                                   !3, ~31
   28    54        CONCAT                                           ~33     'Dave+Chen%3A%09%09%09', !3
         55        CONCAT                                           ~34     ~33, '%0A'
         56        ECHO                                                     ~34
   30    57        INIT_FCALL                                               'microtime'
         58        SEND_VAL                                                 <true>
         59        DO_ICALL                                         $35     
         60        ASSIGN                                                   !0, $35
   32    61        ASSIGN                                                   !2, <array>
   33    62        ASSIGN                                                   !4, 0
         63      > JMP                                                      ->77
   35    64    >   INIT_FCALL                                               'mt_rand'
         65        SEND_VAL                                                 10000
         66        SEND_VAL                                                 99999
         67        DO_ICALL                                         $39     
         68        ASSIGN                                                   !5, $39
   36    69        INIT_FCALL                                               'in_array'
         70        SEND_VAR                                                 !5
         71        SEND_VAR                                                 !2
         72        DO_ICALL                                         $41     
         73      > JMPNZ                                                    $41, ->64
   37    74    >   ASSIGN_DIM                                               !2
         75        OP_DATA                                                  !5
   33    76        PRE_INC                                                  !4
         77    >   IS_SMALLER                                               !4, !1
         78      > JMPNZ                                                    ~44, ->64
   42    79    >   INIT_FCALL                                               'microtime'
         80        SEND_VAL                                                 <true>
         81        DO_ICALL                                         $45     
         82        SUB                                              ~46     $45, !0
         83        ASSIGN                                                   !3, ~46
   43    84        CONCAT                                           ~48     'Josh+from+Qaribou%3A%09%09', !3
         85        CONCAT                                           ~49     ~48, '%0A'
         86        ECHO                                                     ~49
         87      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.96 ms | 1404 KiB | 27 Q