Me and my colleague were arguing about how to return booleans in PHP functions.
Which one do you use and why?
return 0;
return 1;
OR
return false;
return true;
It is clear that first variant it wouldn't work fine in programming languages with strict typing, but it will work absolutely fine in PHP in most cases.
I use first more logical variant, but I couldn't come up with good arguments but "return boolean if you want to return a boolean" and "more readable", but they are quite weak.
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