Re: Discussion: do you consider null a value or strictly a type?
| From: | Curt Zirzow | Date: | Sun, 17 Aug 2003 22:43:55 +0000 |
| Subject: | Re: Discussion: do you consider null a value or strictly a type? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159863@lists.php.net to get a copy of this message | ||
* Thus wrote Robert Cummings (robert@wocmud.org):
>
> Now the point of the discussion is not to indicate who is right or who
> is wrong -- that would appear to be a ridiculous argument. I am more
> interested in finding out the practices and experience of PHP
> developers. I'd like to know how many people treat null as a value, and
> how many do not. For instance to you ever assign default values of null
> to instance variables, or local variable, or array entries? I know in
> practice that I have, and find it quite convenient to represent a
> default value.
I've never used null as a value. Basically I just use '' as a null
value, which changes some logic I used vs. other languages. for
instance, take these values (or non values):
false, 0, '', "", null
if each is seperaly assigned to a variable the expression always
yields the same:
if ( $var) { }
Which is why, I assume, the === operater was born. Although I've
only used that operater maybe once or twice, because I have been
used to having my logic not rely on the type of data that is
stored.
This also leads me to believe that the statement:
if ($var === null) {}
would be considered illegal or fail no matter what since null is
not a value and has no type associated with it.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."