Forum Moderators: coopster
I am working on a theater project. Some members are allowed free tickets, or tickets to be picked up at will call.
I'm trying to get both variables to test as empty so I can customize a report.
I essentially want to say:
if($var1 is not empty) OR ($var2 is not empty) $var1 and $var2 will always be set so I don't think I can use isset. They will just contain the value 0 if they aren't allowed free tickets.
I have tried the following:
if(($a == 0) ¦¦ ($b == 0)){
if(isset($a) ¦¦ isset($b)){
if(empty($a) ¦¦ (empty($b))){
if(!empty($a) ¦¦ (!empty($b))){
if(!($a) ¦¦ (!($b))){
if(($a) ¦¦ (($b))){ None of them seem to be working properly.
If either $a or $b contain anything other than 0, I need the program to echo 1 set of data. If they both contain 0, I basically want it to do nothing.
Can anyone help with the syntax for this? It would be greatly appreciated.
If it's always "something" or "0" why can't you do this?
if (($a>0) or ($b > 0))
You didn't say if $a or $b can be text values, in which case that won't work. If this is the case, I would change the initial/default value to '', a blank string,
$a=$b='';
if (($a!= '') or ($b != ''))