2 answers
Assuming that the words are separated by spaces... (like in a normal sentence) we can do:
For example:
Here $e is an array that contains each word, for example by doing
We have $e[0] = 'this', 1 = 'is', 2 = 'a' and 3 ='sentence'
explode(' ', $text); For example:
$text = file_get_contents('file.txt'); $e = explode(' ', $text); $first_word = $e[0]; Here $e is an array that contains each word, for example by doing
$e = explode(' ', 'this is a sentence'); We have $e[0] = 'this', 1 = 'is', 2 = 'a' and 3 ='sentence'