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;
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 = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/tEKS7
function name:  (null)
number of ops:  55
compiled vars:  !0 = $tstart, !1 = $numberOfRandoms, !2 = $uniques, !3 = $elapsed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
    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                                         $8      
         10        ASSIGN_DIM                                               !2, $8
         11        OP_DATA                                                  <true>
   11    12        INIT_FCALL                                               'array_keys'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $10     
         15        COUNT                                            ~11     $10
         16        IS_SMALLER                                               ~11, !1
         17      > JMPNZ                                                    ~12, ->6
   13    18    >   INIT_FCALL                                               'array_keys'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !2, $13
   15    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $15     
         25        SUB                                              ~16     $15, !0
         26        ASSIGN                                                   !3, ~16
   16    27        CONCAT                                           ~18     !3, '%0A'
         28        ECHO                                                     ~18
   19    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $19     
         32        ASSIGN                                                   !0, $19
   21    33        INIT_FCALL                                               'range'
         34        SEND_VAL                                                 10000
         35        SEND_VAL                                                 99999
         36        DO_ICALL                                         $21     
         37        ASSIGN                                                   !2, $21
   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                                         $24     
         46        ASSIGN                                                   !2, $24
   27    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $26     
         50        SUB                                              ~27     $26, !0
         51        ASSIGN                                                   !3, ~27
   28    52        CONCAT                                           ~29     !3, '%0A'
         53        ECHO                                                     ~29
         54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.04 ms | 948 KiB | 26 Q