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()
My Guess is that
But that doesn't account for any compile time optimizations that it performs here.
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.
if(empty($arr))
echo "Empty";
else
echo "Ok..!";
This is the fastest and secure way to check an array empty or not
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With