Need PHP expression help

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi, I need to validate a string of text against an expression and
having difficulty putting it together. Basically, I want to count the
number of words in a string that are separated by commas. If the count
is more than a predetermined number 9, it will do something, else
something else.  Thank you for assistance.

Re: Need PHP expression help wrote:
Quoted text here. Click to load it

How about
$tmp = explode(',',$your_str);
if (count($tmp) > 9) {
     // do something
} else {
     // do something else


Re: Need PHP expression help

Very nice, that did the trick. :)  Cheers!


Site Timeline