I’ve noticed in my dealings with PHP & javascript, still learning btw, that the following seems to produce the same results.
if( ( $A==0 ) && ( $B==0 ) ){}
if( $A==0 && $B==0 ){}
What is the proper term for this in programming so I can learn more about it.
Parenthesis determine the order in which comparisons are made. Your example is a pretty simple one that doesn’t need parenthesis at all, but look at something like this
This is actually equivalent to
because
&&is evaluated first in PHP as it has a higher precedence than the||IN most cases, when you have complex conditionals, you want to make sure to use parenthesis, if not to get the order of operations right, then at least to make it clear to the code reader what you are trying to do.