I'm kinda stuck with the following:
I have on my form a regular text field where the user is supposed to enter values (numbers) separated by spaces.
When processing the form, I try to both extract the values and count the number of values user has given, like this:
$numberofvalues=sizeof(explode(" ", trim($inputfield)));
Everything works OK, if the user input is in correct format (e.g. "1 2 3"), and the trim() takes care of leading and trailing spaces, but the problems arise if the user input contains more than one spaces between the values, like "1 2 3".
All of a sudden the array generated by explode() has 4 elements instead of 3.
How can I circumvent this?