3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.33 ms | 1400 KiB | 19 Q