explode get the first word in php code example
Example 1: php explode sentence into words
$words = explode(" ", $sentence);
Example 2: php explode and get first value
$beforeDot = array_shift(explode('.', $string));
$beforeDot = current(explode(".", $string));
// PHP <= 5.3:
$beforeDot = explode(".", $string);
$beforeDot = $beforeDot[0];