How can I split a string by word? When I do $words = preg_split('/\b\w+\b/', $message); then the resulting array has the correct number of keys, but the array values are all blank?

Nevermind ... I was able to accomplish what I need without using regex. Instead I used str_word_count()

$words = str_word_count($message, 1);

then the resulting array has the correct number of keys

To answer that for anybody else, preg_split uses the pattern to break the string. Since the \w+ is included it splits on the actual words, thus removing them.

commented: Thanks! +15