jacko310592 Posted January 21, 2010 Share Posted January 21, 2010 hey guys, how would i use OR to say NOT equal to 'value01' OR 'value02' within an IF statment this is what i have so far which doesnt currently work: if ($_SESSION['trackBrowsing'] != "value01" || "value02"){ thanks Quote Link to comment https://forums.phpfreaks.com/topic/189359-this-or-that/ Share on other sites More sharing options...
wildteen88 Posted January 21, 2010 Share Posted January 21, 2010 this is what i have so far which doesnt currently work: if ($_SESSION['trackBrowsing'] != "value01" || "value02"){ Correct way is if ($_SESSION['trackBrowsing'] != "value01" || $_SESSION['trackBrowsing'] != "value02"){ Quote Link to comment https://forums.phpfreaks.com/topic/189359-this-or-that/#findComment-999603 Share on other sites More sharing options...
ignace Posted January 21, 2010 Share Posted January 21, 2010 if ($_SESSION['trackBrowsing'] !== 'value01' && $_SESSION['trackBrowsing'] !== 'value02') Note the && makes this code only execute when $_SESSION['trackBrowsing'] equals something different then value01 and value02 otherwise if you would use || this code would execute when one of both returns true $_SESSION['trackBrowsing'] === 'value01' by which it does not equal value02 for example Quote Link to comment https://forums.phpfreaks.com/topic/189359-this-or-that/#findComment-999605 Share on other sites More sharing options...
jacko310592 Posted January 21, 2010 Author Share Posted January 21, 2010 thanks for the help guys Quote Link to comment https://forums.phpfreaks.com/topic/189359-this-or-that/#findComment-999615 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.