3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = $arr2 = []; $count = 100000; for ($i = $count; $i >= 0; --$i) { $arr[$i] = rand(0, PHP_INT_MAX); } for ($i = $count / 10000; $i >= 0; --$i) { $arr2[ rand(0, PHP_INT_MAX) ] = true; } $t = microtime(true); $arr = array_flip($arr); $result = array_intersect_key($arr2, $arr); var_dump(microtime(true) - $t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 5
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 17
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 17
Branch analysis from position: 26
Branch analysis from position: 17
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 5
Branch analysis from position: 14
Branch analysis from position: 5
filename:       /in/tiDSb
function name:  (null)
number of ops:  47
compiled vars:  !0 = $arr, !1 = $arr2, !2 = $count, !3 = $i, !4 = $t, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                           ~6      !1, <array>
          1        ASSIGN                                                   !0, ~6
    4     2        ASSIGN                                                   !2, 100000
    6     3        ASSIGN                                                   !3, !2
          4      > JMP                                                      ->12
    7     5    >   INIT_FCALL                                               'rand'
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 9223372036854775807
          8        DO_ICALL                                         $11     
          9        ASSIGN_DIM                                               !0, !3
         10        OP_DATA                                                  $11
    6    11        PRE_DEC                                                  !3
         12    >   IS_SMALLER_OR_EQUAL                                      0, !3
         13      > JMPNZ                                                    ~13, ->5
   10    14    >   DIV                                              ~14     !2, 10000
         15        ASSIGN                                                   !3, ~14
         16      > JMP                                                      ->24
   11    17    >   INIT_FCALL                                               'rand'
         18        SEND_VAL                                                 0
         19        SEND_VAL                                                 9223372036854775807
         20        DO_ICALL                                         $16     
         21        ASSIGN_DIM                                               !1, $16
         22        OP_DATA                                                  <true>
   10    23        PRE_DEC                                                  !3
         24    >   IS_SMALLER_OR_EQUAL                                      0, !3
         25      > JMPNZ                                                    ~19, ->17
   14    26    >   INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $20     
         29        ASSIGN                                                   !4, $20
   16    30        INIT_FCALL                                               'array_flip'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $22     
         33        ASSIGN                                                   !0, $22
   17    34        INIT_FCALL                                               'array_intersect_key'
         35        SEND_VAR                                                 !1
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $24     
         38        ASSIGN                                                   !5, $24
   19    39        INIT_FCALL                                               'var_dump'
         40        INIT_FCALL                                               'microtime'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $26     
         43        SUB                                              ~27     $26, !4
         44        SEND_VAL                                                 ~27
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.14 ms | 1400 KiB | 23 Q