[snip]
I am having a user enter a phrase into a textbox, and then I need to 
seperate the words he has typed into variables so I can use each one 
in an sql statement.  I know I will use the explode() function to do
this, 
but how will I know how many variables I've created.  For instance, if a

user types in 3 words seperated by spaces, how will I know i'll have 
var[0] through var[2]?  how about when they type in 2 words or 4 words?

How will I know how many words they have typed in?  The only way I can 
think of to do this is:
[/snip]

Use count() http://www.php.net/count

Counts the array ...

$arrayFoo = explode(" ", $theLine);
$countFoo = count($arrayFoo);

for($i = 0; $i < $countFoo; $i++){
   echo $arrayFoo[$i];
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to