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 certainly

I'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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to