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 = 18, Position 2 = 6
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
2 jumps found. (Code = 44) Position 1 = 78, Position 2 = 63
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
2 jumps found. (Code = 44) Position 1 = 73, Position 2 = 63
Branch analysis from position: 73
2 jumps found. (Code = 44) Position 1 = 78, Position 2 = 63
Branch analysis from position: 78
Branch analysis from position: 63
Branch analysis from position: 63
Branch analysis from position: 6
filename:       /in/26cjl
function name:  (null)
number of ops:  87
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        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     'hek2mgl%3A%09%09%09', !3
         28        CONCAT                                           ~21     ~20, '%0A'
         29        ECHO                                                     ~21
   19    30        INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $22     
         33        ASSIGN                                                   !0, $22
   21    34        INIT_FCALL                                               'range'
         35        SEND_VAL                                                 10000
         36        SEND_VAL                                                 99999
         37        DO_ICALL                                         $24     
         38        ASSIGN                                                   !2, $24
   22    39        INIT_FCALL                                               'shuffle'
         40        SEND_REF                                                 !2
         41        DO_ICALL                                                 
   23    42        INIT_FCALL                                               'array_slice'
         43        SEND_VAR                                                 !2
         44        SEND_VAL                                                 0
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                         $27     
         47        ASSIGN                                                   !2, $27
   27    48        INIT_FCALL                                               'microtime'
         49        SEND_VAL                                                 <true>
         50        DO_ICALL                                         $29     
         51        SUB                                              ~30     $29, !0
         52        ASSIGN                                                   !3, ~30
   28    53        CONCAT                                           ~32     'Dave+Chen%3A%09%09%09', !3
         54        CONCAT                                           ~33     ~32, '%0A'
         55        ECHO                                                     ~33
   30    56        INIT_FCALL                                               'microtime'
         57        SEND_VAL                                                 <true>
         58        DO_ICALL                                         $34     
         59        ASSIGN                                                   !0, $34
   32    60        ASSIGN                                                   !2, <array>
   33    61        ASSIGN                                                   !4, 0
         62      > JMP                                                      ->76
   35    63    >   INIT_FCALL                                               'mt_rand'
         64        SEND_VAL                                                 10000
         65        SEND_VAL                                                 99999
         66        DO_ICALL                                         $38     
         67        ASSIGN                                                   !5, $38
   36    68        INIT_FCALL                                               'in_array'
         69        SEND_VAR                                                 !5
         70        SEND_VAR                                                 !2
         71        DO_ICALL                                         $40     
         72      > JMPNZ                                                    $40, ->63
   37    73    >   ASSIGN_DIM                                               !2
         74        OP_DATA                                                  !5
   33    75        PRE_INC                                                  !4
         76    >   IS_SMALLER                                               !4, !1
         77      > JMPNZ                                                    ~43, ->63
   42    78    >   INIT_FCALL                                               'microtime'
         79        SEND_VAL                                                 <true>
         80        DO_ICALL                                         $44     
         81        SUB                                              ~45     $44, !0
         82        ASSIGN                                                   !3, ~45
   43    83        CONCAT                                           ~47     'Josh+from+Qaribou%3A%09%09', !3
         84        CONCAT                                           ~48     ~47, '%0A'
         85        ECHO                                                     ~48
         86      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.91 ms | 1475 KiB | 20 Q