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 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"){ 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 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 Link to comment https://forums.phpfreaks.com/topic/189359-this-or-that/#findComment-999615 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.