3v4l.org

run code in 300+ PHP versions simultaneously
<?php // one-dimensional arrays $array = array_fill(0,50000,'tommy is the best!'); $arraykeyexists_result = array(); $start = microtime(true); for ($i = 0; $i < 100000; $i++) { if (array_key_exists($i,$array)) { $arraykeyexists_result[] = 1; } else { $arraykeyexists_result[] = 0; } } $arrtime = round(microtime(true)-$start,3); $start = microtime(true); for ($i = 0; $i < 100000; $i++) { if (isset($array[$i])) { $arraykeyexists_result[] = 1; } else { $arraykeyexists_result[] = 0; } } $istime = round(microtime(true)-$start,3); $totaltime = $arrtime+$istime; $arrpercentage = round(100*$arrtime/$totaltime,3); $ispercentage = round(100*$istime/$totaltime,3); echo "array_key_exists(): $arrtime [$arrpercentage%] seconds\n"; echo "isset(): $istime [$ispercentage%] seconds\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 38
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 38
Branch analysis from position: 48
Branch analysis from position: 38
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 38
Branch analysis from position: 48
Branch analysis from position: 38
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
Branch analysis from position: 13
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
Branch analysis from position: 13
filename:       /in/cY0mj
function name:  (null)
number of ops:  86
compiled vars:  !0 = $array, !1 = $arraykeyexists_result, !2 = $start, !3 = $i, !4 = $arrtime, !5 = $istime, !6 = $totaltime, !7 = $arrpercentage, !8 = $ispercentage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 50000
          3        SEND_VAL                                                 'tommy+is+the+best%21'
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !0, $9
    5     6        ASSIGN                                                   !1, <array>
    7     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $12     
         10        ASSIGN                                                   !2, $12
    8    11        ASSIGN                                                   !3, 0
         12      > JMP                                                      ->21
    9    13    >   ARRAY_KEY_EXISTS                                         !3, !0
         14      > JMPZ                                                     ~15, ->18
   10    15    >   ASSIGN_DIM                                               !1
         16        OP_DATA                                                  1
         17      > JMP                                                      ->20
   13    18    >   ASSIGN_DIM                                               !1
         19        OP_DATA                                                  0
    8    20    >   PRE_INC                                                  !3
         21    >   IS_SMALLER                                               !3, 100000
         22      > JMPNZ                                                    ~19, ->13
   16    23    >   INIT_FCALL                                               'round'
         24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $20     
         27        SUB                                              ~21     $20, !2
         28        SEND_VAL                                                 ~21
         29        SEND_VAL                                                 3
         30        DO_ICALL                                         $22     
         31        ASSIGN                                                   !4, $22
   18    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $24     
         35        ASSIGN                                                   !2, $24
   19    36        ASSIGN                                                   !3, 0
         37      > JMP                                                      ->46
   20    38    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !3
         39      > JMPZ                                                     ~27, ->43
   21    40    >   ASSIGN_DIM                                               !1
         41        OP_DATA                                                  1
         42      > JMP                                                      ->45
   24    43    >   ASSIGN_DIM                                               !1
         44        OP_DATA                                                  0
   19    45    >   PRE_INC                                                  !3
         46    >   IS_SMALLER                                               !3, 100000
         47      > JMPNZ                                                    ~31, ->38
   27    48    >   INIT_FCALL                                               'round'
         49        INIT_FCALL                                               'microtime'
         50        SEND_VAL                                                 <true>
         51        DO_ICALL                                         $32     
         52        SUB                                              ~33     $32, !2
         53        SEND_VAL                                                 ~33
         54        SEND_VAL                                                 3
         55        DO_ICALL                                         $34     
         56        ASSIGN                                                   !5, $34
   29    57        ADD                                              ~36     !4, !5
         58        ASSIGN                                                   !6, ~36
   30    59        INIT_FCALL                                               'round'
         60        MUL                                              ~38     !4, 100
         61        DIV                                              ~39     ~38, !6
         62        SEND_VAL                                                 ~39
         63        SEND_VAL                                                 3
         64        DO_ICALL                                         $40     
         65        ASSIGN                                                   !7, $40
   31    66        INIT_FCALL                                               'round'
         67        MUL                                              ~42     !5, 100
         68        DIV                                              ~43     ~42, !6
         69        SEND_VAL                                                 ~43
         70        SEND_VAL                                                 3
         71        DO_ICALL                                         $44     
         72        ASSIGN                                                   !8, $44
   33    73        ROPE_INIT                                     5  ~47     'array_key_exists%28%29%3A+'
         74        ROPE_ADD                                      1  ~47     ~47, !4
         75        ROPE_ADD                                      2  ~47     ~47, '+%5B'
         76        ROPE_ADD                                      3  ~47     ~47, !7
         77        ROPE_END                                      4  ~46     ~47, '%25%5D+seconds%0A'
         78        ECHO                                                     ~46
   34    79        ROPE_INIT                                     5  ~51     'isset%28%29%3A++++++++++++'
         80        ROPE_ADD                                      1  ~51     ~51, !5
         81        ROPE_ADD                                      2  ~51     ~51, '+%5B'
         82        ROPE_ADD                                      3  ~51     ~51, !8
         83        ROPE_END                                      4  ~50     ~51, '%25%5D+seconds%0A'
         84        ECHO                                                     ~50
         85      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.99 ms | 1396 KiB | 19 Q