3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $subject = "3rd from last"; preg_match('~^(?Pindex[0-9]+)st|nd|rd|th from (?P<position>last|end|start|beginning)$~', $subject, $matches); var_dump($matches);
Output for 5.2.3 - 7.1.0
Warning: preg_match(): Compilation failed: unrecognized character after (?P at offset 4 in /in/kHuob on line 4 NULL
Output for 5.2.0 - 5.2.2
<br /> <b>Warning</b>: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Compilation failed: unrecognized character after (?P at offset 4 in <b>/in/kHuob</b> on line <b>4</b><br /> NULL
Output for 4.4.3 - 5.1.6
<br /> <b>Warning</b>: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Compilation failed: unrecognized character after (?P at offset 4 in <b>/in/kHuob</b> on line <b>4</b><br /> array(0) { }
Output for 4.3.11 - 4.4.2
<br /> <b>Warning</b>: preg_match(): Compilation failed: unrecognized character after (?P at offset 4 in <b>/in/kHuob</b> on line <b>4</b><br /> array(0) { }
Output for 4.3.0 - 4.3.10
<br /> <b>Warning</b>: Compilation failed: unrecognized character after (?P at offset 4 in <b>/in/kHuob</b> on line <b>4</b><br /> array(0) { }