News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dan Horrigan's Blog:
The Value of Null
April 19, 2011 @ 10:51:18

Dan Horrigan has a new post to his blog talking about the value of null - a quick summary about when and where null should be used. Null's a value too, after all...

Let me start off by saying this article is about PHP and PHP alone. Other languages handle this sort of thing differently (and better). In PHP many people (and a few frameworks) return FALSE from methods when the requested value does not exist. However, I am here to tell you that if you do this, you are doing it wrong. Plain and Simple.

In his opinion, "false" is definitely not the same thing as "null" because "null" is technically the absence of a value, not a "not true" value like "false" is. He illustrates with a simple use case of a class that has methods returning various values.

0 comments voice your opinion now!
value null opinion false return


blog comments powered by Disqus

Similar Posts

Jani Hartikainen's Blog: 5 ways how PHP is better than Node.js

Till Klampaeckel's Blog: Contributing to PEAR: Taking over packages

Pádraic Brady's Blog: PHP: Innocent Villagefolk or a Pillagin' Pirate?

Laura Thomson's Blog: Do all frameworks really suck?

NETTUTS.com: 10 Compelling Reasons to Use Zend Framework


Community Events





Don't see your event here?
Let us know!


language symfony2 testing developer list series community interview code refactor experience framework laravel release threedevsandamaybe install introduction podcast unittest opinion

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework