TEENFRONT Posted April 12, 2006 Share Posted April 12, 2006 hey, i have a review script that displays info from the db.how do i check if $value and $value exists, and if BOTH OR EITHER exists, display sumthing..atm im cecking if each exisit one by one soif ($var) { display bleh } if ($var2) { display bleh2 } and so on, but i want to check if both or either exist, then display bleh.Does anyone get what i mean lol? sorry if ya dont. Link to comment https://forums.phpfreaks.com/topic/7245-if-value-value/ Share on other sites More sharing options...
AndyB Posted April 12, 2006 Share Posted April 12, 2006 [code] if (($var) || ($var2)) { echo "bleh";}[/code] Link to comment https://forums.phpfreaks.com/topic/7245-if-value-value/#findComment-26393 Share on other sites More sharing options...
Barand Posted April 12, 2006 Share Posted April 12, 2006 [code]if ($var1 && $var2) { echo "Both exist";}elseif ($var1 || $var2) { echo "one of them exists";}else { echo "Neither exist";}[/code] Link to comment https://forums.phpfreaks.com/topic/7245-if-value-value/#findComment-26395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.