Searching a string for one word...
Posted: Mon May 19, 2003 7:12 am
Okay... patience please... new to PHP...
Damn... PHP is nothing like Cold Fusion!
I'm looking to build a "restricted word" function into an online forum. When users post a message, I want to search the subject and message for a restricted word. For example, if it contains "foo" they're not allowed to post the message. (Long story on the reasons why)
What is the correct IF syntax to see if a string contains a particular word? In CF, it's IF #string CONTAINS "foo"... but I'm not finding the PHP equivalent.
-edit-
um... also... not to impose too much...
I'd also like to build in conditional logic that checks new usernames and restricts names to only numbers, characters a-z, and such. Is there a quick way in PHP to run this check?
Thanks.
Damn... PHP is nothing like Cold Fusion!
I'm looking to build a "restricted word" function into an online forum. When users post a message, I want to search the subject and message for a restricted word. For example, if it contains "foo" they're not allowed to post the message. (Long story on the reasons why)
What is the correct IF syntax to see if a string contains a particular word? In CF, it's IF #string CONTAINS "foo"... but I'm not finding the PHP equivalent.
-edit-
um... also... not to impose too much...
I'd also like to build in conditional logic that checks new usernames and restricts names to only numbers, characters a-z, and such. Is there a quick way in PHP to run this check?
Thanks.