Use the strtolower function to reduce all letters to lower case.

Then use the stripos() function to find where the spaces are in the string
and use that position in the substr() function to parse out the individual
words in the string. From there you can put the chunks into an array or a
query or whatever you're going to do with them.

You can also consider using the str_word_count(mystring, 1) to obtain an
array containing the words in the string. Check out the function in the
documentation to see how it treats different string types though - the
results may not be what you need.

You can also use the above strategy to find the periods in the sentences and
either remove them or just exclude them from whatever it is you're going to
do with the results of your parsing.

Probably a few other ways to get the results you're looking for including a
couple pre-built functions or classes if you Google for them.

-----Original Message-----
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 29, 2006 11:21 AM
Subject: [PHP-DB] Array

If I have the sentences

Check one two three four.  You did well to count to four.

how do I put each word into an array (so there would be 12 components in the
array) as well as remove the period and make the C in Check and the Y in You
lower case


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to