3v4l.org

run code in 300+ PHP versions simultaneously
<?php $expression = "3rd from end"; preg_match('~^(?P<offset>[0-9]+)(?:st|nd|rd|th)* from (?P<position>start|beginning|last|end)+$~', $expression, $matches); var_dump($matches);

preferences:
47.94 ms | 402 KiB | 5 Q