3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.7 ms | 1400 KiB | 27 Q