By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

opposite of isset

tolkienarda
100+
P: 316
hi all

i have an if statement but i need to use the oppsite of isset like isn'tset only i know that isn't right is it like !isset or isset! or somthing totaly different

eric
Feb 20 '07 #1
Share this Question
Share on Google+
4 Replies


The1corrupted
100+
P: 134
Perhaps you could try this...

[PHP]
if (isset($var)) {

Do what you don't want to do here...

} else {
Do what you want here
}[/PHP]
Feb 20 '07 #2

ronverdonk
Expert 2.5K+
P: 4,258
The isset() function returns a boolean. So it is either true or false.

When you test using if (isset(xxx)) your action is performed on the true result of the isset.
When you test using if (!isset(xxx)) your action follows the true result of the NOT isset.

Hope this is clear. So the answer is: test with !isset(xx)

Ronald :cool:
Feb 20 '07 #3

tolkienarda
100+
P: 316
thanks that was very clear

eric
Feb 20 '07 #4

ronverdonk
Expert 2.5K+
P: 4,258
As ever: you are welcome.

Ronald :cool:
Feb 20 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.