So I have an if-statement and I am not sure how is the best way to write it. Or if there is a proper way of writing it. Can I just use && every time or should I separate them with more () or does it really matter, is there a difference in performance ect?
$a = 10;
$b = 20;
$c = 8;
$d = 25;
$e = "";
$f = "not blank";
// FIRST EXAMPLE
if (!empty($e) && !empty($f) && $a <= $c && $b <= $d)
{
// do something here
}
OR
if ( (!empty($e) && !empty($f)) && ($a <= $c && $b <= $d))
{
// do something here
}
AND, then there's no need for brackets at all. If you have someORconditions combined withANDconditions, you'll likely need some brackets.