Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF NOT statement with PHP 1

Status
Not open for further replies.

Guggly

Programmer
Joined
Jan 18, 2004
Messages
110
Location
US
Sorry, this is probably a real dumb question, but I can't find any reference on it (and it sure is hard to do a decent search on the words "if" and "not" :).

How can I do an IF NOT statement in PHP? What I want is something like this:

if NOT (evaluation) {
do code
}

I've tried evaluating to false, using "!=" and "<>", but they all give me an error.
Of course I can use an if...else syntax and I will do that for now, but there must be a better way, since I only want to perform the action if something doesn't evaluate.

Thanks! -- Mike
 
its quite straightfoward.

if(!$something){ // ! is NOT operator

//do stuff

}else{ // else{ is optional.

do other stuff

}

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Just what I need. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top