3v4l.org

run code in 300+ PHP versions simultaneously
<?php // initial position var_dump(preg_match('#/search/(?P<mac>(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\2){4}[[:xdigit:]]{2})#', '/search/12-12-12-12-12-12', $matches)); var_dump($matches); // named subpattern var_dump(preg_match('#/search/(?P<mac>(?:[[:xdigit:]]{2}(?P<sep>[-:]))(?:[[:xdigit:]]{2}(?P=sep)){4}[[:xdigit:]]{2})#', '/search/12-12-12-12-12-12', $matches)); var_dump($matches); // impossible to fix in general var_dump(preg_match('#/(?P<id>\d+)/(?P<mac>(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\3){4}[[:xdigit:]]{2})#', '/555/12-12-12-12-12-12', $matches)); var_dump($matches); //fix var_dump(preg_match('#((?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\2){4}[[:xdigit:]]{2})#', '12-12-12-12-12-12', $matches)); var_dump($matches); // problem //var_dump(preg_match('#(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\2){4}[[:xdigit:]]{2}#', '12-12-12-12-12-12', $matches)); //var_dump($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rJXYk
function name:  (null)
number of ops:  45
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%23%2Fsearch%2F%28%3FP%3Cmac%3E%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%28%5B-%3A%5D%29%29%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%5C2%29%7B4%7D%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%29%23'
          3        SEND_VAL                                                 '%2Fsearch%2F12-12-12-12-12-12'
          4        SEND_REF                                                 !0
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                                 
    5     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
    9    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'preg_match'
         13        SEND_VAL                                                 '%23%2Fsearch%2F%28%3FP%3Cmac%3E%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%28%3FP%3Csep%3E%5B-%3A%5D%29%29%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%28%3FP%3Dsep%29%29%7B4%7D%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%29%23'
         14        SEND_VAL                                                 '%2Fsearch%2F12-12-12-12-12-12'
         15        SEND_REF                                                 !0
         16        DO_ICALL                                         $4      
         17        SEND_VAR                                                 $4
         18        DO_ICALL                                                 
   10    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   14    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'preg_match'
         24        SEND_VAL                                                 '%23%2F%28%3FP%3Cid%3E%5Cd%2B%29%2F%28%3FP%3Cmac%3E%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%28%5B-%3A%5D%29%29%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%5C3%29%7B4%7D%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%29%23'
         25        SEND_VAL                                                 '%2F555%2F12-12-12-12-12-12'
         26        SEND_REF                                                 !0
         27        DO_ICALL                                         $7      
         28        SEND_VAR                                                 $7
         29        DO_ICALL                                                 
   15    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
   19    33        INIT_FCALL                                               'var_dump'
         34        INIT_FCALL                                               'preg_match'
         35        SEND_VAL                                                 '%23%28%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%28%5B-%3A%5D%29%29%28%3F%3A%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%5C2%29%7B4%7D%5B%5B%3Axdigit%3A%5D%5D%7B2%7D%29%23'
         36        SEND_VAL                                                 '12-12-12-12-12-12'
         37        SEND_REF                                                 !0
         38        DO_ICALL                                         $10     
         39        SEND_VAR                                                 $10
         40        DO_ICALL                                                 
   20    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                                 
   24    44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.79 ms | 1400 KiB | 17 Q