3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.58 ms | 1400 KiB | 27 Q