- 3
Bad example if ($age > 18)
good examle: if ($age >= 18)
3 Respostas
+ 2
in what context?
+ 2
?
I don't understand, both are good, it depends on the situation. In most situations I'd use ($age > 18) so I can check if my user is an adult or not.
+ 2
Both are good, simply by the fact than in integer context $age >=18 is strictly equivalent to $age > 17...
In a floating point context, that's not strictly equivalent, but > or >= are good or bad depending of the context, not in absolute ^^