3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string ='2firstword21mytargetstring'; if (preg_match ('/\d(\D*)$/', $string, $match)) var_dump($match[1]);

preferences:
44.5 ms | 402 KiB | 5 Q