How to get the first word of a sentence in PHP? The first word of a sentence can be obtained with the help of various inbuilt functions like strtok(), strstr(), explode() and some other methods like using regular expressions.
You can use the PHP explode() function as follows:
$myvalue = 'Test me more';
$arr = explode(' ',trim($myvalue));
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.