3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); echo setlocale(LC_ALL, 0)."\n"; // echo setlocale(LC_ALL, "en_GB.UTF-8")."\n"; $terms = array ( //Always matches: "Label Generation", //Doesn't match when using u (PCRE_UTF8) modifier: "Receipt of Prescription and Validation of Patient Information", ); $text = "Some terms to match: ".implode(", ",$terms); $pattern = "/(".implode(")|(", $terms).")/is"; $regexps = array ( "Unicode" => $pattern."u", //Add u (PCRE_UTF8) modifier "Non-unicode" => $pattern ); echo "Text:\n'$text'\n"; foreach($regexps as $type=>$regexp) { $matches = array(); $total = preg_match_all($regexp,$text,$matches); echo "\n\n"; echo "$type regex:\n'$regexp'\n\n"; echo "Total $type matches: "; var_dump($total); echo "\n$type matches: "; var_dump($matches[0]); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 67
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 67
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
filename:       /in/nQFLs
function name:  (null)
number of ops:  69
compiled vars:  !0 = $terms, !1 = $text, !2 = $pattern, !3 = $regexps, !4 = $regexp, !5 = $type, !6 = $matches, !7 = $total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    3     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 '1'
          6        DO_ICALL                                                 
    5     7        INIT_FCALL                                               'setlocale'
          8        SEND_VAL                                                 6
          9        SEND_VAL                                                 0
         10        DO_ICALL                                         $10     
         11        CONCAT                                           ~11     $10, '%0A'
         12        ECHO                                                     ~11
    8    13        ASSIGN                                                   !0, <array>
   17    14        INIT_FCALL                                               'implode'
         15        SEND_VAL                                                 '%2C+'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $13     
         18        CONCAT                                           ~14     'Some+terms+to+match%3A+', $13
         19        ASSIGN                                                   !1, ~14
   18    20        INIT_FCALL                                               'implode'
         21        SEND_VAL                                                 '%29%7C%28'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $16     
         24        CONCAT                                           ~17     '%2F%28', $16
         25        CONCAT                                           ~18     ~17, '%29%2Fis'
         26        ASSIGN                                                   !2, ~18
   21    27        CONCAT                                           ~20     !2, 'u'
         28        INIT_ARRAY                                       ~21     ~20, 'Unicode'
   22    29        ADD_ARRAY_ELEMENT                                ~21     !2, 'Non-unicode'
   19    30        ASSIGN                                                   !3, ~21
   25    31        ROPE_INIT                                     3  ~24     'Text%3A%0A%27'
         32        ROPE_ADD                                      1  ~24     ~24, !1
         33        ROPE_END                                      2  ~23     ~24, '%27%0A'
         34        ECHO                                                     ~23
   27    35      > FE_RESET_R                                       $26     !3, ->67
         36    > > FE_FETCH_R                                       ~27     $26, !4, ->67
         37    >   ASSIGN                                                   !5, ~27
   29    38        ASSIGN                                                   !6, <array>
   30    39        INIT_FCALL                                               'preg_match_all'
         40        SEND_VAR                                                 !4
         41        SEND_VAR                                                 !1
         42        SEND_REF                                                 !6
         43        DO_ICALL                                         $30     
         44        ASSIGN                                                   !7, $30
   32    45        ECHO                                                     '%0A%0A'
   33    46        ROPE_INIT                                     4  ~33     !5
         47        ROPE_ADD                                      1  ~33     ~33, '+regex%3A%0A%27'
         48        ROPE_ADD                                      2  ~33     ~33, !4
         49        ROPE_END                                      3  ~32     ~33, '%27%0A%0A'
         50        ECHO                                                     ~32
   34    51        ROPE_INIT                                     3  ~36     'Total+'
         52        ROPE_ADD                                      1  ~36     ~36, !5
         53        ROPE_END                                      2  ~35     ~36, '+matches%3A+'
         54        ECHO                                                     ~35
   35    55        INIT_FCALL                                               'var_dump'
         56        SEND_VAR                                                 !7
         57        DO_ICALL                                                 
   36    58        ROPE_INIT                                     3  ~40     '%0A'
         59        ROPE_ADD                                      1  ~40     ~40, !5
         60        ROPE_END                                      2  ~39     ~40, '+matches%3A+'
         61        ECHO                                                     ~39
   37    62        INIT_FCALL                                               'var_dump'
         63        FETCH_DIM_R                                      ~42     !6, 0
         64        SEND_VAL                                                 ~42
         65        DO_ICALL                                                 
   27    66      > JMP                                                      ->36
         67    >   FE_FREE                                                  $26
   39    68      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.36 ms | 1400 KiB | 25 Q