3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); $amount = 1000000; $start = microtime(true); for($i = 0; $i < $amount ; $i++) { $alreadyOutput = array(); foreach ($results as $result) { if(in_array($result->date, $alreadyOutput)){ continue; } $alreadyOutput[] = $result->date; echo $result->date . "<br />"; } } echo "in_array: ".(microtime(true) - $start)."ms || "; $start2 = microtime(true); for($i = 0; $i < $amount ; $i++) { $echoedArray = array(); foreach ($results as $result) { if ($echoedArray[$result->date]) { continue; } echo $result->date . "<br />"; $echoedArray[$result->date] = true; } } echo "by key: ".(microtime(true) - $start2)."ms";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 10
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 44
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 77) Position 1 = 46, Position 2 = 58
Branch analysis from position: 46
2 jumps found. (Code = 78) Position 1 = 47, Position 2 = 58
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 44
Branch analysis from position: 62
Branch analysis from position: 44
Branch analysis from position: 58
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 10
Branch analysis from position: 31
Branch analysis from position: 10
Branch analysis from position: 27
filename:       /in/9Wku6
function name:  (null)
number of ops:  70
compiled vars:  !0 = $amount, !1 = $start, !2 = $i, !3 = $alreadyOutput, !4 = $results, !5 = $result, !6 = $start2, !7 = $echoedArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
    3     3        ASSIGN                                                   !0, 1000000
    4     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !1, $10
    5     8        ASSIGN                                                   !2, 0
          9      > JMP                                                      ->29
    6    10    >   ASSIGN                                                   !3, <array>
    7    11      > FE_RESET_R                                       $14     !4, ->27
         12    > > FE_FETCH_R                                               $14, !5, ->27
    8    13    >   INIT_FCALL                                               'in_array'
         14        FETCH_OBJ_R                                      ~15     !5, 'date'
         15        SEND_VAL                                                 ~15
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $16     
         18      > JMPZ                                                     $16, ->20
    9    19    > > JMP                                                      ->12
   11    20    >   FETCH_OBJ_R                                      ~18     !5, 'date'
         21        ASSIGN_DIM                                               !3
         22        OP_DATA                                                  ~18
   12    23        FETCH_OBJ_R                                      ~19     !5, 'date'
         24        CONCAT                                           ~20     ~19, '%3Cbr+%2F%3E'
         25        ECHO                                                     ~20
    7    26      > JMP                                                      ->12
         27    >   FE_FREE                                                  $14
    5    28        PRE_INC                                                  !2
         29    >   IS_SMALLER                                               !2, !0
         30      > JMPNZ                                                    ~22, ->10
   15    31    >   INIT_FCALL                                               'microtime'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $23     
         34        SUB                                              ~24     $23, !1
         35        CONCAT                                           ~25     'in_array%3A+', ~24
         36        CONCAT                                           ~26     ~25, 'ms+%7C%7C+'
         37        ECHO                                                     ~26
   17    38        INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $27     
         41        ASSIGN                                                   !6, $27
   18    42        ASSIGN                                                   !2, 0
         43      > JMP                                                      ->60
   19    44    >   ASSIGN                                                   !7, <array>
   20    45      > FE_RESET_R                                       $31     !4, ->58
         46    > > FE_FETCH_R                                               $31, !5, ->58
   21    47    >   FETCH_OBJ_R                                      ~32     !5, 'date'
         48        FETCH_DIM_R                                      ~33     !7, ~32
         49      > JMPZ                                                     ~33, ->51
   22    50    > > JMP                                                      ->46
   24    51    >   FETCH_OBJ_R                                      ~34     !5, 'date'
         52        CONCAT                                           ~35     ~34, '%3Cbr+%2F%3E'
         53        ECHO                                                     ~35
   25    54        FETCH_OBJ_R                                      ~36     !5, 'date'
         55        ASSIGN_DIM                                               !7, ~36
         56        OP_DATA                                                  <true>
   20    57      > JMP                                                      ->46
         58    >   FE_FREE                                                  $31
   18    59        PRE_INC                                                  !2
         60    >   IS_SMALLER                                               !2, !0
         61      > JMPNZ                                                    ~39, ->44
   28    62    >   INIT_FCALL                                               'microtime'
         63        SEND_VAL                                                 <true>
         64        DO_ICALL                                         $40     
         65        SUB                                              ~41     $40, !6
         66        CONCAT                                           ~42     'by+key%3A+', ~41
         67        CONCAT                                           ~43     ~42, 'ms'
         68        ECHO                                                     ~43
         69      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.01 ms | 1400 KiB | 19 Q