delphi123 Posted December 11, 2007 Share Posted December 11, 2007 I have the following line to open an if - basically I'm checking that the user DOES have an id set and that they HAVEN'T got a cookie. if (isset($_GET['id'])&& isset($_COOKIE[$software_cookie])) How can I change the above statement so it does this? Link to comment https://forums.phpfreaks.com/topic/81178-solved-very-quick-question-opposite-of-isset/ Share on other sites More sharing options...
adam291086 Posted December 11, 2007 Share Posted December 11, 2007 if (isset($_GET['id'])&& !isset($_COOKIE[$software_cookie])) I think that will work. Feel free to correct me anyone i am still on the steep learning curve of php. Link to comment https://forums.phpfreaks.com/topic/81178-solved-very-quick-question-opposite-of-isset/#findComment-411889 Share on other sites More sharing options...
Lumio Posted December 11, 2007 Share Posted December 11, 2007 You mean, that you want to ask if it is not set? Like that: <?php if (!isset($var) && !isset($var)) { //code... } //or if (isset($var) === false && isset($var) === false) { //your code } ?> Link to comment https://forums.phpfreaks.com/topic/81178-solved-very-quick-question-opposite-of-isset/#findComment-411890 Share on other sites More sharing options...
themistral Posted December 11, 2007 Share Posted December 11, 2007 isset checks to see if something is set and !isset checks something is not set Link to comment https://forums.phpfreaks.com/topic/81178-solved-very-quick-question-opposite-of-isset/#findComment-411896 Share on other sites More sharing options...
delphi123 Posted December 11, 2007 Author Share Posted December 11, 2007 perfect! learn something every time! Link to comment https://forums.phpfreaks.com/topic/81178-solved-very-quick-question-opposite-of-isset/#findComment-411902 Share on other sites More sharing options...
Lumio Posted December 11, 2007 Share Posted December 11, 2007 3 posts and all the same. hmm... okay You can also use empty. But empty is a little bit different... var_dump( empty("0") ); var_dump( empty("") ); both are true. Link to comment https://forums.phpfreaks.com/topic/81178-solved-very-quick-question-opposite-of-isset/#findComment-412014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.