This is a discussion on Need PHP expression help within the PHP Language forums, part of the PHP Programming Forums category; Hi, I need to validate a string of text against an expression and having difficulty putting it together. Basically, I ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
Ragnorack67@hotmail.com wrote: > 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. How about <? $tmp = explode(',',$your_str); if (count($tmp) > 9) { // do something } else { // do something else } ?> Ken |