3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/^(\b\w+\b).*\b\1\b.*/i'; //should match $string = "TheseCharacters, I really enjoy TheseCharacters"; $result = preg_match($pattern, $string, $matches); echo "String 1 matches {$result} times: ".print_r($matches,true)."\n"; //should match $string = "TheseCharacters, I really enjoy TheseCharacters"; $result = preg_match($pattern, $string, $matches); echo "String 1 matches {$result} times: ".print_r($matches,true)."\n"; //match only with case insensitive flag, not an exact match in case $string = "TheseCharacters, I really enjoy TheseCharacters and some others"; $result = preg_match($pattern, $string, $matches); echo "String 2 matches {$result} times: ".print_r($matches,true)."\n"; //no match, TheseCharacters has been changed to TheseLetters $string = "TheseCharacters, I really enjoy TheseLetters"; $result = preg_match($pattern, $string, $matches); echo "String 3 matches {$result} times: ".print_r($matches,true)."\n"; //no match, additional letters has been added to TheseCharacters $string = "TheseCharacters, I really enjoy TheseCharactersasdf"; $result = preg_match($pattern, $string, $matches); echo "String 4 matches {$result} times: ".print_r($matches,true)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/upNhm
function name:  (null)
number of ops:  87
compiled vars:  !0 = $pattern, !1 = $string, !2 = $result, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%2F%5E%28%5Cb%5Cw%2B%5Cb%29.%2A%5Cb%5C1%5Cb.%2A%2Fi'
    5     1        ASSIGN                                                   !1, 'TheseCharacters%2C+I+really+enjoy+TheseCharacters'
    6     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !3
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
    7     8        ROPE_INIT                                     3  ~9      'String+1+matches+'
          9        ROPE_ADD                                      1  ~9      ~9, !2
         10        ROPE_END                                      2  ~8      ~9, '+times%3A+'
         11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $11     
         15        CONCAT                                           ~12     ~8, $11
         16        CONCAT                                           ~13     ~12, '%0A'
         17        ECHO                                                     ~13
   10    18        ASSIGN                                                   !1, 'TheseCharacters%2C+I+really+enjoy+TheseCharacters'
   11    19        INIT_FCALL                                               'preg_match'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !1
         22        SEND_REF                                                 !3
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !2, $15
   12    25        ROPE_INIT                                     3  ~18     'String+1+matches+'
         26        ROPE_ADD                                      1  ~18     ~18, !2
         27        ROPE_END                                      2  ~17     ~18, '+times%3A+'
         28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !3
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $20     
         32        CONCAT                                           ~21     ~17, $20
         33        CONCAT                                           ~22     ~21, '%0A'
         34        ECHO                                                     ~22
   15    35        ASSIGN                                                   !1, 'TheseCharacters%2C+I+really+enjoy+TheseCharacters+and+some+others'
   16    36        INIT_FCALL                                               'preg_match'
         37        SEND_VAR                                                 !0
         38        SEND_VAR                                                 !1
         39        SEND_REF                                                 !3
         40        DO_ICALL                                         $24     
         41        ASSIGN                                                   !2, $24
   17    42        ROPE_INIT                                     3  ~27     'String+2+matches+'
         43        ROPE_ADD                                      1  ~27     ~27, !2
         44        ROPE_END                                      2  ~26     ~27, '+times%3A+'
         45        INIT_FCALL                                               'print_r'
         46        SEND_VAR                                                 !3
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $29     
         49        CONCAT                                           ~30     ~26, $29
         50        CONCAT                                           ~31     ~30, '%0A'
         51        ECHO                                                     ~31
   20    52        ASSIGN                                                   !1, 'TheseCharacters%2C+I+really+enjoy+TheseLetters'
   21    53        INIT_FCALL                                               'preg_match'
         54        SEND_VAR                                                 !0
         55        SEND_VAR                                                 !1
         56        SEND_REF                                                 !3
         57        DO_ICALL                                         $33     
         58        ASSIGN                                                   !2, $33
   22    59        ROPE_INIT                                     3  ~36     'String+3+matches+'
         60        ROPE_ADD                                      1  ~36     ~36, !2
         61        ROPE_END                                      2  ~35     ~36, '+times%3A+'
         62        INIT_FCALL                                               'print_r'
         63        SEND_VAR                                                 !3
         64        SEND_VAL                                                 <true>
         65        DO_ICALL                                         $38     
         66        CONCAT                                           ~39     ~35, $38
         67        CONCAT                                           ~40     ~39, '%0A'
         68        ECHO                                                     ~40
   25    69        ASSIGN                                                   !1, 'TheseCharacters%2C+I+really+enjoy+TheseCharactersasdf'
   26    70        INIT_FCALL                                               'preg_match'
         71        SEND_VAR                                                 !0
         72        SEND_VAR                                                 !1
         73        SEND_REF                                                 !3
         74        DO_ICALL                                         $42     
         75        ASSIGN                                                   !2, $42
   27    76        ROPE_INIT                                     3  ~45     'String+4+matches+'
         77        ROPE_ADD                                      1  ~45     ~45, !2
         78        ROPE_END                                      2  ~44     ~45, '+times%3A+'
         79        INIT_FCALL                                               'print_r'
         80        SEND_VAR                                                 !3
         81        SEND_VAL                                                 <true>
         82        DO_ICALL                                         $47     
         83        CONCAT                                           ~48     ~44, $47
         84        CONCAT                                           ~49     ~48, '%0A'
         85        ECHO                                                     ~49
         86      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.68 ms | 1400 KiB | 17 Q