3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = array_merge(range(0, 100), array()); shuffle($array); const LOOPS = 1000; $b = hrtime(true); for ($i = 0; $i < LOOPS; ++$i) { $c = $array; $c = array_unique($c); } $e = hrtime(true); print number_format( ($e - $b) / 1_000_000, 2). " ms\n"; $b = hrtime(true); for ($i = 0; $i < LOOPS; ++$i) { $c = $array; $d = array_keys(array_count_values($c)); } $e = hrtime(true); print number_format(($e - $b) / 1_000_000, 2). " ms\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 19
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 46
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 46
Branch analysis from position: 58
Branch analysis from position: 46
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 19
Branch analysis from position: 28
Branch analysis from position: 19
filename:       /in/mCTDV
function name:  (null)
number of ops:  71
compiled vars:  !0 = $array, !1 = $b, !2 = $i, !3 = $c, !4 = $e, !5 = $d
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'array_merge'
          1        INIT_FCALL                                                   'range'
          2        SEND_VAL                                                     0
          3        SEND_VAL                                                     100
          4        DO_ICALL                                             $6      
          5        SEND_VAR                                                     $6
          6        SEND_VAL                                                     <array>
          7        DO_ICALL                                             $7      
          8        ASSIGN                                                       !0, $7
    4     9        INIT_FCALL                                                   'shuffle'
         10        SEND_REF                                                     !0
         11        DO_ICALL                                                     
    6    12        DECLARE_CONST                                                'LOOPS', 1000
    8    13        INIT_FCALL                                                   'hrtime'
         14        SEND_VAL                                                     <true>
         15        DO_ICALL                                             $10     
         16        ASSIGN                                                       !1, $10
    9    17        ASSIGN                                                       !2, 0
         18      > JMP                                                          ->25
   10    19    >   ASSIGN                                                       !3, !0
   11    20        INIT_FCALL                                                   'array_unique'
         21        SEND_VAR                                                     !3
         22        DO_ICALL                                             $14     
         23        ASSIGN                                                       !3, $14
    9    24        PRE_INC                                                      !2
         25    >   FETCH_CONSTANT                                       ~17     'LOOPS'
         26        IS_SMALLER                                                   !2, ~17
         27      > JMPNZ                                                        ~18, ->19
   13    28    >   INIT_FCALL                                                   'hrtime'
         29        SEND_VAL                                                     <true>
         30        DO_ICALL                                             $19     
         31        ASSIGN                                                       !4, $19
   14    32        INIT_FCALL                                                   'number_format'
         33        SUB                                                  ~21     !4, !1
         34        DIV                                                  ~22     ~21, 1000000
         35        SEND_VAL                                                     ~22
         36        SEND_VAL                                                     2
         37        DO_ICALL                                             $23     
         38        CONCAT                                               ~24     $23, '+ms%0A'
         39        ECHO                                                         ~24
   16    40        INIT_FCALL                                                   'hrtime'
         41        SEND_VAL                                                     <true>
         42        DO_ICALL                                             $25     
         43        ASSIGN                                                       !1, $25
   17    44        ASSIGN                                                       !2, 0
         45      > JMP                                                          ->55
   18    46    >   ASSIGN                                                       !3, !0
   19    47        INIT_FCALL                                                   'array_keys'
         48        INIT_FCALL                                                   'array_count_values'
         49        SEND_VAR                                                     !3
         50        DO_ICALL                                             $29     
         51        SEND_VAR                                                     $29
         52        DO_ICALL                                             $30     
         53        ASSIGN                                                       !5, $30
   17    54        PRE_INC                                                      !2
         55    >   FETCH_CONSTANT                                       ~33     'LOOPS'
         56        IS_SMALLER                                                   !2, ~33
         57      > JMPNZ                                                        ~34, ->46
   21    58    >   INIT_FCALL                                                   'hrtime'
         59        SEND_VAL                                                     <true>
         60        DO_ICALL                                             $35     
         61        ASSIGN                                                       !4, $35
   22    62        INIT_FCALL                                                   'number_format'
         63        SUB                                                  ~37     !4, !1
         64        DIV                                                  ~38     ~37, 1000000
         65        SEND_VAL                                                     ~38
         66        SEND_VAL                                                     2
         67        DO_ICALL                                             $39     
         68        CONCAT                                               ~40     $39, '+ms%0A'
         69        ECHO                                                         ~40
         70      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.18 ms | 1368 KiB | 21 Q