Re: what happened to that new isset() like language
| From: | James Crumpton | Date: | Sat, 29 Oct 2005 20:27:33 +0000 |
| Subject: | Re: what happened to that new isset() like language | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19820@lists.php.net to get a copy of this message | ||
A good point certainly... I suppose it could continue to follow the current form, evaluating $c as false and return int(1) instead of bool(true). Though that would probably diminish it's utility for 'if set or'. And there would be a BC break for those doing:
$a = $b || $c;
if ($a === true) {
}
But anyone doing that should probably have their head examined.
Anyway...
Regardless of what can be said about changing the behavior of '||', the same isn't true for '||=', as it has no precedence in PHP.
-james
Greg Beaver wrote:
James Crumpton wrote:Evaluating an idea based on it's syntactic similarities to other languages is complete and utter nonsense. It has nothing to with being like language Xyz. It has to do with familiarity to language constructs. One already understands the idea of 'this || that'. It's certainlyI'll throw the water on this one: <?php $c = 0; $a = 1; var_dump($c || $a); ?> With the existing PHP, this script results in: bool(true) With your proposed change because it would return the first non-null set variable, it will instead output: int(0) Changing true into false consitutes a rather severe BC break :). Greg