DEV Community

PHP - please do not use ! and empty() if you can help it

Piotr Szymaszek on January 30, 2020

This is just a short shout out to the PHP folks - please do not cast variables during comparison using either ! or empty(). Let me explain with an...
Collapse
 
aleksikauppila profile image
Aleksi Kauppila

More explicit checks make the code more readable and remove ambiguity early and not just pass the confusion down the stack πŸ‘

Still, understanding how $apiβ€”>get() behaves is our first priority. If it’s unreliable, we may have to adapt it to something more reliable.