Just a bit of fun, wondered which of these people like best for checking if an array is empty in #php? There's (debatably :D) no right answer...

#1 is short
#2 and #3 are very readable

Leaning towards #2 myself!

Hopefully I typed the example code properly lol. xD

@scottwhat I generally use 1, because I'm lazy. Arguably 3 is most correct(tm). Don't use 2.
@Crell
@scottwhat
I would write it like this:
ยด
if (count($array)) $emptyArray = false;
ยด
Seems my way of thinking is somehow different, I don't know ๐Ÿ˜
@amarok @scottwhat That's a reasonable compromise.

@Crell @amarok @scottwhat first one also use implicit cast, by using `!`
Even when checking if an array is not empty with just `if($array)`, it an implicit cast. I always use a boolean value in condition.

So I will compare the array to an empty array or if number of elements is 0.

I think that will be future proof if any implicit cast / behavior change in PHP engine ๐Ÿ™‚

@velkuns @Crell @amarok Sounds good! A strict and future-proof comparison.