3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total = 10000; $paragraph = 'this is a sentence. Crud! $$$$!'; $words = explode(' ', $paragraph); $badWordHash = [ '$$$$' => true, '@#$%' => true, 'crud' => true, 'fud' => true, 'fudd' => true, 'dud' => true ]; $s = microtime(true); for ($j = 0; $j < $total; $j++) { foreach ($words as $word) { isset($badWordHash[strtolower($word)]); } } echo "isset: ", (microtime(true) - $s), PHP_EOL; $s = microtime(true); for ($j = 0; $j < $total; $j++) { foreach ($words as $word) { array_key_exists(strtolower($word), $badWordHash); } } echo "array_key_exists: ", (microtime(true) - $s), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 39
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 77) Position 1 = 40, Position 2 = 47
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 47
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 39
Branch analysis from position: 51
Branch analysis from position: 39
Branch analysis from position: 47
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
Branch analysis from position: 14
Branch analysis from position: 22
filename:       /in/cqTjX
function name:  (null)
number of ops:  59
compiled vars:  !0 = $total, !1 = $paragraph, !2 = $words, !3 = $badWordHash, !4 = $s, !5 = $j, !6 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 10000
    4     1        ASSIGN                                                   !1, 'this+is+a+sentence.+Crud%21+%24%24%24%24%21'
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
    7     7        ASSIGN                                                   !3, <array>
   16     8        INIT_FCALL                                               'microtime'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !4, $12
   17    12        ASSIGN                                                   !5, 0
         13      > JMP                                                      ->24
   18    14    > > FE_RESET_R                                       $15     !2, ->22
         15    > > FE_FETCH_R                                               $15, !6, ->22
   19    16    >   INIT_FCALL                                               'strtolower'
         17        SEND_VAR                                                 !6
         18        DO_ICALL                                         $16     
         19        ISSET_ISEMPTY_DIM_OBJ                         0  ~17     !3, $16
         20        FREE                                                     ~17
   18    21      > JMP                                                      ->15
         22    >   FE_FREE                                                  $15
   17    23        PRE_INC                                                  !5
         24    >   IS_SMALLER                                               !5, !0
         25      > JMPNZ                                                    ~19, ->14
   23    26    >   ECHO                                                     'isset%3A+++++++++++++'
         27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $20     
         30        SUB                                              ~21     $20, !4
         31        ECHO                                                     ~21
         32        ECHO                                                     '%0A'
   25    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $22     
         36        ASSIGN                                                   !4, $22
   26    37        ASSIGN                                                   !5, 0
         38      > JMP                                                      ->49
   27    39    > > FE_RESET_R                                       $25     !2, ->47
         40    > > FE_FETCH_R                                               $25, !6, ->47
   28    41    >   INIT_FCALL                                               'strtolower'
         42        SEND_VAR                                                 !6
         43        DO_ICALL                                         $26     
         44        ARRAY_KEY_EXISTS                                 ~27     $26, !3
         45        FREE                                                     ~27
   27    46      > JMP                                                      ->40
         47    >   FE_FREE                                                  $25
   26    48        PRE_INC                                                  !5
         49    >   IS_SMALLER                                               !5, !0
         50      > JMPNZ                                                    ~29, ->39
   32    51    >   ECHO                                                     'array_key_exists%3A+'
         52        INIT_FCALL                                               'microtime'
         53        SEND_VAL                                                 <true>
         54        DO_ICALL                                         $30     
         55        SUB                                              ~31     $30, !4
         56        ECHO                                                     ~31
         57        ECHO                                                     '%0A'
         58      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.09 ms | 1400 KiB | 19 Q