3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<TEXT I would like to know what method is good to get the first 20 words from an english sentence. I need to analyze its subject and verb before processing further. TEXT; echo preg_replace('/(?:\s*\S+){10}\K.*/', '', $string);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
I would like to know what method is good to

preferences:
65.86 ms | 402 KiB | 62 Q