note 113692 deleted from types.comparisons by peehaa
| From: | peehaa@php.net | Date: | Mon, 02 Dec 2013 09:39:20 +0000 |
| Subject: | note 113692 deleted from types.comparisons by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197722@lists.php.net to get a copy of this message | ||
Note Submitter: 777s7s777 at gmail dot com
----
I've found that, at least in the PHP version I'm using, setting a variable to true (i.e.
"$var = true;"), then passing it to a function (i.e. "Test($var);"), will cause
the passed variable within that method to be considered null/nully (i.e. "if ($var !=
null)" returns false), even if from within the calling function it is not considered
null/nully. (i.e. "if ($var != null)" returns true)
In other words, passing a true boolean variable to a function will turn it into a null/nully value,
within the function.
To me this seems extremely odd, and backwards, behavior.
If a variable is "!= null" in the caller function, it should be "!= null" in the
called function.
(Note: My PHP version is 5.4.3)