3v4l.org

run code in 500+ 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 = 42, Position 2 = 66
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 66
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 59
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
filename:       /in/Jh0Zb
function name:  (null)
number of ops:  68
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                                                   'array_map'
          3        SEND_VAL                                                     'preg_quote'
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $8      
          6        FRAMELESS_ICALL_2                implode             ~9      '%7C', $8
          7        CONCAT                                               ~10     '%23', ~9
          8        CONCAT                                               ~11     ~10, '%23'
          9        ASSIGN_DIM                                                   !2
         10        OP_DATA                                                      ~11
   10    11        ASSIGN                                                       !1, <array>
   11    12        INIT_FCALL                                                   'array_map'
         13        SEND_VAL                                                     'preg_quote'
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                             $14     
         16        FRAMELESS_ICALL_2                implode             ~15     '%7C', $14
         17        CONCAT                                               ~16     '%23', ~15
         18        CONCAT                                               ~17     ~16, '%23i'
         19        ASSIGN_DIM                                                   !2
         20        OP_DATA                                                      ~17
   14    21        ASSIGN                                                       !1, <array>
   15    22        INIT_FCALL                                                   'array_map'
         23        SEND_VAL                                                     'preg_quote'
         24        SEND_VAR                                                     !1
         25        DO_ICALL                                             $20     
         26        FRAMELESS_ICALL_2                implode             ~21     '%7C', $20
         27        CONCAT                                               ~22     '%23%5Cb%28%3F%3A', ~21
         28        CONCAT                                               ~23     ~22, '%29%5Cb%23i'
         29        ASSIGN_DIM                                                   !2
         30        OP_DATA                                                      ~23
   18    31        ASSIGN                                                       !1, <array>
   19    32        INIT_FCALL                                                   'array_map'
         33        SEND_VAL                                                     'preg_quote'
         34        SEND_VAR                                                     !1
         35        DO_ICALL                                             $26     
         36        FRAMELESS_ICALL_2                implode             ~27     '%7C', $26
         37        CONCAT                                               ~28     '%23%5Cb%28%3F%3A', ~27
         38        CONCAT                                               ~29     ~28, '%29%5Cb%23iu'
         39        ASSIGN_DIM                                                   !2
         40        OP_DATA                                                      ~29
   21    41      > FE_RESET_R                                           $30     !2, ->66
         42    > > FE_FETCH_R                                                   $30, !3, ->66
   22    43    >   INIT_FCALL                                                   'preg_match'
         44        SEND_VAR                                                     !3
         45        SEND_VAR                                                     !0
         46        SEND_REF                                                     !4
         47        DO_ICALL                                             $31     
         48      > JMPZ                                                         $31, ->59
   23    49    >   ROPE_INIT                                         7  ~34     'found+%27'
         50        FETCH_DIM_R                                          ~32     !4, 0
         51        ROPE_ADD                                          1  ~34     ~34, ~32
         52        ROPE_ADD                                          2  ~34     ~34, '%27+using+'
         53        ROPE_ADD                                          3  ~34     ~34, !3
         54        ROPE_ADD                                          4  ~34     ~34, '+on+'
         55        ROPE_ADD                                          5  ~34     ~34, !0
         56        ROPE_END                                          6  ~33     ~34, '%0A'
         57        ECHO                                                         ~33
   22    58      > JMP                                                          ->65
   25    59    >   ROPE_INIT                                         5  ~39     'no+match+using+'
         60        ROPE_ADD                                          1  ~39     ~39, !3
         61        ROPE_ADD                                          2  ~39     ~39, '+on+'
         62        ROPE_ADD                                          3  ~39     ~39, !0
         63        ROPE_END                                          4  ~38     ~39, '%0A'
         64        ECHO                                                         ~38
   21    65    > > JMP                                                          ->42
         66    >   FE_FREE                                                      $30
   27    67      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.32 ms | 1747 KiB | 15 Q