note 113692 added to types.comparisons

From: Date: Sun, 17 Nov 2013 00:56:27 +0000
Subject: note 113692 added to types.comparisons
Groups: php.notes 
Request: Send a blank email to php-notes+get-197542@lists.php.net to get a copy of this message
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) ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/types.comparisons.php Edit -- https://master.php.net/note/edit/113692 Del: integrated -- https://master.php.net/note/delete/113692/integrated Del: useless -- https://master.php.net/note/delete/113692/useless Del: bad code -- https://master.php.net/note/delete/113692/bad+code Del: spam -- https://master.php.net/note/delete/113692/spam Del: non-english -- https://master.php.net/note/delete/113692/non-english Del: in docs -- https://master.php.net/note/delete/113692/in+docs Del: other reasons-- https://master.php.net/note/delete/113692 Reject -- https://master.php.net/note/reject/113692 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197542) next »