This is mostly superficial but what's the best (faster performing, not personal preference or readability) way to check if an array is empty:
count($arr) == 0
empty($arr)
$arr === array()
- Other?
My Guess is that
- Iterates as far as possible then returns
- Simply performs 1 after checking if the variable is an array
- Seems like it should be slow as it has to construct a new object to compare with
But that doesn't account for any compile time optimizations that it performs here.
Disclaimer
I'm not about to go through my code base changes all instances to the fastest possible method so please don't remind me it's micro optimzation. This is simple curiosity.