3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'My nAmE ïs Tom.'; // case-sensitive matching, including partial matching $array = ['foo', 'nAmE']; $regex[] = '#' . implode('|', array_map('preg_quote', $array)) . '#'; // case-insensitive matching, including partial matching $array = ['foo', 'om']; $regex[] = '#' . implode('|', array_map('preg_quote', $array)) . '#i'; // case-insensitive matching, full word matching only $array = ['foo', 'tom']; $regex[] = '#\b(?:' . implode('|', array_map('preg_quote', $array)) . ')\b#i'; // case-insensitive matching, full word matching only, multibyte aware $array = ['foo', 'ïs']; $regex[] = '#\b(?:' . implode('|', array_map('preg_quote', $array)) . ')\b#iu'; foreach ($regex as $r) { if (preg_match($r, $string, $m)) { echo "found '$m[0]' using $r on $string\n"; } else { echo "no match using $r on $string\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 54, Position 2 = 78
Branch analysis from position: 54
2 jumps found. (Code = 78) Position 1 = 55, Position 2 = 78
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 71
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
filename:       /in/Jh0Zb
function name:  (null)
number of ops:  80
compiled vars:  !0 = $string, !1 = $array, !2 = $regex, !3 = $r, !4 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'My+nAmE+%C3%AFs+Tom.'
    6     1        ASSIGN                                                   !1, <array>
    7     2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '%7C'
          4        INIT_FCALL                                               'array_map'
          5        SEND_VAL                                                 'preg_quote'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $8      
          8        SEND_VAR                                                 $8
          9        DO_ICALL                                         $9      
         10        CONCAT                                           ~10     '%23', $9
         11        CONCAT                                           ~11     ~10, '%23'
         12        ASSIGN_DIM                                               !2
         13        OP_DATA                                                  ~11
   10    14        ASSIGN                                                   !1, <array>
   11    15        INIT_FCALL                                               'implode'
         16        SEND_VAL                                                 '%7C'
         17        INIT_FCALL                                               'array_map'
         18        SEND_VAL                                                 'preg_quote'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $14     
         21        SEND_VAR                                                 $14
         22        DO_ICALL                                         $15     
         23        CONCAT                                           ~16     '%23', $15
         24        CONCAT                                           ~17     ~16, '%23i'
         25        ASSIGN_DIM                                               !2
         26        OP_DATA                                                  ~17
   14    27        ASSIGN                                                   !1, <array>
   15    28        INIT_FCALL                                               'implode'
         29        SEND_VAL                                                 '%7C'
         30        INIT_FCALL                                               'array_map'
         31        SEND_VAL                                                 'preg_quote'
         32        SEND_VAR                                                 !1
         33        DO_ICALL                                         $20     
         34        SEND_VAR                                                 $20
         35        DO_ICALL                                         $21     
         36        CONCAT                                           ~22     '%23%5Cb%28%3F%3A', $21
         37        CONCAT                                           ~23     ~22, '%29%5Cb%23i'
         38        ASSIGN_DIM                                               !2
         39        OP_DATA                                                  ~23
   18    40        ASSIGN                                                   !1, <array>
   19    41        INIT_FCALL                                               'implode'
         42        SEND_VAL                                                 '%7C'
         43        INIT_FCALL                                               'array_map'
         44        SEND_VAL                                                 'preg_quote'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                         $26     
         47        SEND_VAR                                                 $26
         48        DO_ICALL                                         $27     
         49        CONCAT                                           ~28     '%23%5Cb%28%3F%3A', $27
         50        CONCAT                                           ~29     ~28, '%29%5Cb%23iu'
         51        ASSIGN_DIM                                               !2
         52        OP_DATA                                                  ~29
   21    53      > FE_RESET_R                                       $30     !2, ->78
         54    > > FE_FETCH_R                                               $30, !3, ->78
   22    55    >   INIT_FCALL                                               'preg_match'
         56        SEND_VAR                                                 !3
         57        SEND_VAR                                                 !0
         58        SEND_REF                                                 !4
         59        DO_ICALL                                         $31     
         60      > JMPZ                                                     $31, ->71
   23    61    >   ROPE_INIT                                     7  ~34     'found+%27'
         62        FETCH_DIM_R                                      ~32     !4, 0
         63        ROPE_ADD                                      1  ~34     ~34, ~32
         64        ROPE_ADD                                      2  ~34     ~34, '%27+using+'
         65        ROPE_ADD                                      3  ~34     ~34, !3
         66        ROPE_ADD                                      4  ~34     ~34, '+on+'
         67        ROPE_ADD                                      5  ~34     ~34, !0
         68        ROPE_END                                      6  ~33     ~34, '%0A'
         69        ECHO                                                     ~33
   22    70      > JMP                                                      ->77
   25    71    >   ROPE_INIT                                     5  ~39     'no+match+using+'
         72        ROPE_ADD                                      1  ~39     ~39, !3
         73        ROPE_ADD                                      2  ~39     ~39, '+on+'
         74        ROPE_ADD                                      3  ~39     ~39, !0
         75        ROPE_END                                      4  ~38     ~39, '%0A'
         76        ECHO                                                     ~38
   21    77    > > JMP                                                      ->54
         78    >   FE_FREE                                                  $30
   27    79      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.17 ms | 1005 KiB | 16 Q