Hey,
This has been annoying me for a bit now, I've tried googling, just isn't happening for me lol
I want to do something like this
if A and B are true
do this
else
do this
+rep to any help![]()

Hey,
This has been annoying me for a bit now, I've tried googling, just isn't happening for me lol
I want to do something like this
if A and B are true
do this
else
do this
+rep to any help![]()
Joe
if (a && b) {
do this
} else {
do this
}
you mean that? orrrr
Yeah, join the statements with && (logical AND) if you want both conditions satiisfied or || for either to be satisfied (logical OR).
PHP Code:$a = true;
$b = false;
if ($a && $b) {
echo "Both are true!";
} else {
echo "One of them or both are not true."; // This will be the result.
}
if ($a || $b) {
echo "At lease one is true"; // This will be the result.
} else {
echo "Neither is true.";
}
Last edited by N!ck; 14-04-2011 at 12:03 AM.
Thanks a lot, works![]()
Joe
Want to hide these adverts? Register an account for free!