3v4l.org

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

preferences:
34.49 ms | 402 KiB | 5 Q