<?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
- Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- A
B
Warning: Undefined array key "MARK" in /in/tMkan on line 12
- Output for 5.6.0 - 5.6.25, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
- A
B
Notice: Undefined index: MARK in /in/tMkan on line 12
- Output for 7.3.32 - 7.3.33
- A
B
preferences:
158.25 ms | 401 KiB | 183 Q