3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex = '/^http:\/\/([\w.]+)\/([\w]+)\/([\w]+)\.html$/i'; $str = 'http://www.youku.com/show_page/id_ABCDEFG.html'; $matches = array (); if (preg_match ( $regex, $str, $matches )) { var_dump ( $matches ); } echo "\n"; $regex = '#^http://([\w.]+)/([\w]+)/([\w]+)\.html$#i'; $str = 'http://www.youku.com/show_page/id_ABCDEFG.html'; $matches = array (); if (preg_match ( $regex, $str, $matches )) { var_dump ( $matches ); } echo "\n"; $regex = '/^[\d]{5,}$/i'; $str = '324546'; $matches = array (); if (preg_match ( $regex, $str, $matches )) { var_dump ( $matches ); } echo "\n"; if(preg_match("/php/i", "PHP is the web scripting language of choice.", $matches)){ print "A match was found:". $matches[0]; var_dump($matches); } else { print "A match was not found."; } $regex = '/HELLO/'; $str = 'hello word'; $matches = array(); if(preg_match($regex, $str, $matches)){ echo 'No i:Valid Successful!',"\n"; } if(preg_match($regex.'i', $str, $matches)){ echo 'YES i:Valid Successful!',"\n"; } $regex = '/HE(?=L)LO/i'; $str = 'HELLO'; $matches = array(); if(preg_match($regex, $str, $matches)){ var_dump($matches); } echo "\n"; $regex = '/HE(?=L)LLO/i'; $str = 'HELLO'; $matches = array(); if(preg_match($regex, $str, $matches)){ var_dump($matches); } echo "\n"; $regex = '/^(Chuanshanjia)[\w\s]+$/'; $regex2='/^(Chuanshanjia)([\w]|[\s])+$/'; $str = 'Chuanshanjia thank Chuanshanjia'; $matches = array(); if(preg_match($regex2, $str, $matches)){ var_dump($matches); } echo "\n"; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 52
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 62, Position 2 = 64
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 73
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 82, Position 2 = 85
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 98
Branch analysis from position: 95
2 jumps found. (Code = 43) Position 1 = 109, Position 2 = 112
Branch analysis from position: 109
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 112
Branch analysis from position: 98
Branch analysis from position: 85
Branch analysis from position: 73
Branch analysis from position: 64
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 62, Position 2 = 64
Branch analysis from position: 62
Branch analysis from position: 64
Branch analysis from position: 38
Branch analysis from position: 25
Branch analysis from position: 12
filename:       /in/058I8
function name:  (null)
number of ops:  114
compiled vars:  !0 = $regex, !1 = $str, !2 = $matches, !3 = $regex2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%2F%5Ehttp%3A%5C%2F%5C%2F%28%5B%5Cw.%5D%2B%29%5C%2F%28%5B%5Cw%5D%2B%29%5C%2F%28%5B%5Cw%5D%2B%29%5C.html%24%2Fi'
    4     1        ASSIGN                                                   !1, 'http%3A%2F%2Fwww.youku.com%2Fshow_page%2Fid_ABCDEFG.html'
    5     2        ASSIGN                                                   !2, <array>
    7     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !2
          7        DO_ICALL                                         $7      
          8      > JMPZ                                                     $7, ->12
    8     9    >   INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   11    12    >   ECHO                                                     '%0A'
   13    13        ASSIGN                                                   !0, '%23%5Ehttp%3A%2F%2F%28%5B%5Cw.%5D%2B%29%2F%28%5B%5Cw%5D%2B%29%2F%28%5B%5Cw%5D%2B%29%5C.html%24%23i'
   14    14        ASSIGN                                                   !1, 'http%3A%2F%2Fwww.youku.com%2Fshow_page%2Fid_ABCDEFG.html'
   15    15        ASSIGN                                                   !2, <array>
   17    16        INIT_FCALL                                               'preg_match'
         17        SEND_VAR                                                 !0
         18        SEND_VAR                                                 !1
         19        SEND_REF                                                 !2
         20        DO_ICALL                                         $12     
         21      > JMPZ                                                     $12, ->25
   18    22    >   INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
   21    25    >   ECHO                                                     '%0A'
   23    26        ASSIGN                                                   !0, '%2F%5E%5B%5Cd%5D%7B5%2C%7D%24%2Fi'
   24    27        ASSIGN                                                   !1, '324546'
   25    28        ASSIGN                                                   !2, <array>
   26    29        INIT_FCALL                                               'preg_match'
         30        SEND_VAR                                                 !0
         31        SEND_VAR                                                 !1
         32        SEND_REF                                                 !2
         33        DO_ICALL                                         $17     
         34      > JMPZ                                                     $17, ->38
   27    35    >   INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                                 
   30    38    >   ECHO                                                     '%0A'
   32    39        INIT_FCALL                                               'preg_match'
         40        SEND_VAL                                                 '%2Fphp%2Fi'
         41        SEND_VAL                                                 'PHP+is+the+web+scripting+language+of+choice.'
         42        SEND_REF                                                 !2
         43        DO_ICALL                                         $19     
         44      > JMPZ                                                     $19, ->52
   33    45    >   FETCH_DIM_R                                      ~20     !2, 0
         46        CONCAT                                           ~21     'A+match+was+found%3A', ~20
         47        ECHO                                                     ~21
   34    48        INIT_FCALL                                               'var_dump'
         49        SEND_VAR                                                 !2
         50        DO_ICALL                                                 
         51      > JMP                                                      ->53
   36    52    >   ECHO                                                     'A+match+was+not+found.'
   40    53    >   ASSIGN                                                   !0, '%2FHELLO%2F'
   41    54        ASSIGN                                                   !1, 'hello+word'
   42    55        ASSIGN                                                   !2, <array>
   44    56        INIT_FCALL                                               'preg_match'
         57        SEND_VAR                                                 !0
         58        SEND_VAR                                                 !1
         59        SEND_REF                                                 !2
         60        DO_ICALL                                         $26     
         61      > JMPZ                                                     $26, ->64
   45    62    >   ECHO                                                     'No+i%3AValid+Successful%21'
         63        ECHO                                                     '%0A'
   48    64    >   INIT_FCALL                                               'preg_match'
         65        CONCAT                                           ~27     !0, 'i'
         66        SEND_VAL                                                 ~27
         67        SEND_VAR                                                 !1
         68        SEND_REF                                                 !2
         69        DO_ICALL                                         $28     
         70      > JMPZ                                                     $28, ->73
   49    71    >   ECHO                                                     'YES+i%3AValid+Successful%21'
         72        ECHO                                                     '%0A'
   52    73    >   ASSIGN                                                   !0, '%2FHE%28%3F%3DL%29LO%2Fi'
   53    74        ASSIGN                                                   !1, 'HELLO'
   54    75        ASSIGN                                                   !2, <array>
   56    76        INIT_FCALL                                               'preg_match'
         77        SEND_VAR                                                 !0
         78        SEND_VAR                                                 !1
         79        SEND_REF                                                 !2
         80        DO_ICALL                                         $32     
         81      > JMPZ                                                     $32, ->85
   57    82    >   INIT_FCALL                                               'var_dump'
         83        SEND_VAR                                                 !2
         84        DO_ICALL                                                 
   60    85    >   ECHO                                                     '%0A'
   61    86        ASSIGN                                                   !0, '%2FHE%28%3F%3DL%29LLO%2Fi'
   62    87        ASSIGN                                                   !1, 'HELLO'
   63    88        ASSIGN                                                   !2, <array>
   65    89        INIT_FCALL                                               'preg_match'
         90        SEND_VAR                                                 !0
         91        SEND_VAR                                                 !1
         92        SEND_REF                                                 !2
         93        DO_ICALL                                         $37     
         94      > JMPZ                                                     $37, ->98
   66    95    >   INIT_FCALL                                               'var_dump'
         96        SEND_VAR                                                 !2
         97        DO_ICALL                                                 
   69    98    >   ECHO                                                     '%0A'
   71    99        ASSIGN                                                   !0, '%2F%5E%28Chuanshanjia%29%5B%5Cw%5Cs%5D%2B%24%2F'
   72   100        ASSIGN                                                   !3, '%2F%5E%28Chuanshanjia%29%28%5B%5Cw%5D%7C%5B%5Cs%5D%29%2B%24%2F'
   73   101        ASSIGN                                                   !1, 'Chuanshanjia+thank+Chuanshanjia'
   74   102        ASSIGN                                                   !2, <array>
   76   103        INIT_FCALL                                               'preg_match'
        104        SEND_VAR                                                 !3
        105        SEND_VAR                                                 !1
        106        SEND_REF                                                 !2
        107        DO_ICALL                                         $43     
        108      > JMPZ                                                     $43, ->112
   77   109    >   INIT_FCALL                                               'var_dump'
        110        SEND_VAR                                                 !2
        111        DO_ICALL                                                 
   80   112    >   ECHO                                                     '%0A'
   85   113      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.45 ms | 1404 KiB | 17 Q