Hi
is that possible to do that?
<?php if($limit != "0" && $num_down < $limit || $limit == "0") {
//stuff
}
?>
i need to check if limit equals to 0 or if it is not, if $num_down is under limit.
Thank you
Hi
is that possible to do that?
<?php if($limit != "0" && $num_down < $limit || $limit == "0") {
//stuff
}
?>
i need to check if limit equals to 0 or if it is not, if $num_down is under limit.
Thank you
Don't make it any more complicated than necessary:
if ($limit == 0 || $num_down < $limit) {
...
}
This works because the logical or (||) evaluates to true if either or both of its arguments evaluate to true.
if( ($limit != 0 && $num_down < $limit) || $limit == 0 )
{
whateves();
}
You can do it this way if you want to evaluate the first condition before the second. You can also use another if branch.
Check out the manual page for operator precedence