Get First Word of String Using PHP

Hi guys today i will tell you through this tutorial that how do we get the first word of any sentence from javascript code.

Get first word of string,
Get first word of string in PHP,
Get first word of string Using PHP,
Get first word from Sentence using PHP,
PHP Get first word/part of a sentence


$myvalue = 'my name is rahul.';
$arr = explode(' ',trim($myvalue));
echo $arr[0]; // will print Test