Dealing with null
Here's an excerpt taken from Front Line PHP where different strategies to handle null are explained
Read more [front-line-php.com]
Posts tagged with null handling
Here's an excerpt taken from Front Line PHP where different strategies to handle null are explained
Read more [front-line-php.com]
Matthias Noback published the second article in his programming guidelines series. This time he explains why using null in a function isn't a good idea. In my opinion it's great advice that most devs can immediately apply in their projects.
It's certainly a good idea to get rid of the uncertainty and vagueness that null brings to your code. Besides, most of the time when you encounter an actual null value in your program, you probably weren't expecting it. You just call a method on it, thinking that it is an object and PHP will rightfully let your program crash.https://www.ibuildings.nl/blog/2016/01/programming-guidelines-php-developers-part-2-getting-rid-null...
Every particular null situation requires a different solution, but at least I'll list several common solutions for you.