3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex = '/X(*MARK:A)Y|X(*MARK:B)Z/'; preg_match($regex, "XY", $matches); echo $matches['MARK'], "\n"; // A preg_match($regex, "XZ", $matches); echo $matches['MARK'], "\n"; // B preg_match($regex, "XP", $matches); echo $matches['MARK'], "\n"; // Should also be B, instead: Notice: Undefined index: MARK
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tMkan
function name:  (null)
number of ops:  26
compiled vars:  !0 = $regex, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2FX%28%2AMARK%3AA%29Y%7CX%28%2AMARK%3AB%29Z%2F'
    5     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'XY'
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    6     6        FETCH_DIM_R                                      ~4      !1, 'MARK'
          7        ECHO                                                     ~4
          8        ECHO                                                     '%0A'
    8     9        INIT_FCALL                                               'preg_match'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'XZ'
         12        SEND_REF                                                 !1
         13        DO_ICALL                                                 
    9    14        FETCH_DIM_R                                      ~6      !1, 'MARK'
         15        ECHO                                                     ~6
         16        ECHO                                                     '%0A'
   11    17        INIT_FCALL                                               'preg_match'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 'XP'
         20        SEND_REF                                                 !1
         21        DO_ICALL                                                 
   12    22        FETCH_DIM_R                                      ~8      !1, 'MARK'
         23        ECHO                                                     ~8
         24        ECHO                                                     '%0A'
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.53 ms | 1400 KiB | 15 Q