What you like use in some simple cases? Here's what I know. Is there any other way? Tell me.
And which is good?
As Atul Sharma said, it is about readability. I follow simple rule which is write code for others to read and understand.
Reading others code is a difficult task so do not make it impossible one. The first statement explains purpose by itself.
I have a very specific opinion which concerns consistency but besides that we can argue about how things should look.
The only thing I want to point out is that
&& has a higher cardinality than AND
php.net/manual/en/language.operators.precedence.p…
so consistency is key. the rest is taste.
Atul Sharma
Full Stack Developer | Cloud Native Applications
1 is the best, it's easy to understand for anyone. Remember, when you are working for someone .. your code is not your's , others need to understand & work on it sometimes. So, make it as simple as possible, avoid fancy shorthands , hacks that most of the people can't understand.
2nd and 3rd are same anyone who understands 2nd can easily understand 3rd.