3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Starting in_array\n"; $limit = 40000; $arr = [30, 367]; $time = microtime(true); for($i = 0; $i < $limit; ++$i) { if (in_array($i, $arr)) { } } $time = microtime(true) - $time; echo 'in_array() took ' . number_format($time, 3) . " seconds\n"; $time = microtime(true); for($i = 0; $i < $limit; ++$i) { if ($i === 30 || $i === 367) { } } $time = microtime(true) - $time; echo 'in_array() took ' . number_format($time, 3) . " seconds\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 9
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 35
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 47) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 35
Branch analysis from position: 43
Branch analysis from position: 35
Branch analysis from position: 40
Branch analysis from position: 39
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 9
Branch analysis from position: 17
Branch analysis from position: 9
Branch analysis from position: 14
filename:       /in/MA6mR
function name:  (null)
number of ops:  56
compiled vars:  !0 = $limit, !1 = $arr, !2 = $time, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     'Starting+in_array%0A'
    4     1        ASSIGN                                                   !0, 40000
    5     2        ASSIGN                                                   !1, <array>
    7     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
    8     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->15
    9     9    >   INIT_FCALL                                               'in_array'
         10        SEND_VAR                                                 !3
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $9      
         13      > JMPZ                                                     $9, ->14
    8    14    >   PRE_INC                                                  !3
         15    >   IS_SMALLER                                               !3, !0
         16      > JMPNZ                                                    ~11, ->9
   12    17    >   INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $12     
         20        SUB                                              ~13     $12, !2
         21        ASSIGN                                                   !2, ~13
   14    22        INIT_FCALL                                               'number_format'
         23        SEND_VAR                                                 !2
         24        SEND_VAL                                                 3
         25        DO_ICALL                                         $15     
         26        CONCAT                                           ~16     'in_array%28%29+took+', $15
         27        CONCAT                                           ~17     ~16, '+seconds%0A'
         28        ECHO                                                     ~17
   16    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $18     
         32        ASSIGN                                                   !2, $18
   17    33        ASSIGN                                                   !3, 0
         34      > JMP                                                      ->41
   18    35    >   IS_IDENTICAL                                     ~21     !3, 30
         36      > JMPNZ_EX                                         ~21     ~21, ->39
         37    >   IS_IDENTICAL                                     ~22     !3, 367
         38        BOOL                                             ~21     ~22
         39    > > JMPZ                                                     ~21, ->40
   17    40    >   PRE_INC                                                  !3
         41    >   IS_SMALLER                                               !3, !0
         42      > JMPNZ                                                    ~24, ->35
   21    43    >   INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $25     
         46        SUB                                              ~26     $25, !2
         47        ASSIGN                                                   !2, ~26
   23    48        INIT_FCALL                                               'number_format'
         49        SEND_VAR                                                 !2
         50        SEND_VAL                                                 3
         51        DO_ICALL                                         $28     
         52        CONCAT                                           ~29     'in_array%28%29+took+', $28
         53        CONCAT                                           ~30     ~29, '+seconds%0A'
         54        ECHO                                                     ~30
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.57 ms | 1400 KiB | 19 Q