3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'admin wrote a new post, FIRE 2 days, 2 hours ago'; if (preg_match('/\bpost, \K\S+/', $string, $match)) { echo $match[0]; } echo "\n---\n"; $string = preg_replace('/.*\bpost, (\S+).*/', '$1', $string, 1, $count); if ($count) { echo $string; }
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
FIRE --- FIRE

preferences:
71.38 ms | 402 KiB | 91 Q