Hi all,

I'm trying to build a spell checker for a web form.
What has got me stumped is being able to do a split
so that whitespace and words are stored as seperate
elements of the same array.

ideally, I'd use some form of preg_split to put:

"This  contans    white space   ."

into an array like:

$wordsarr = ('This','  ','contans','    ','white',' ','space','   ','.')

So that I can do a a loop as follows:

for ($i = 0; $i < count($wordarr); $i++)
  if (!trim($wordarr[$i]) == "" && !eregi(trim($wordarr[$i]),'.,/'))
     //check spelling
     //correct errors
  echo $wordarr[$i];
and end up with:
"This  contains    white space   ."

can a split like this be accomplished using 
preg_split or do I need to go through the string 
one space at a time in a while loop?


Northern.CA ===---

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to