On 12.11.2016 at 17:21, David Walker wrote:

> Should
> $a = 1;
> var_dump(1 < $a++ < 3);
> 
> (expanded into numbers) be evaluated as:
> 1 < 2 && 2 < 3 - True
> or
> 1 < 2 && 3 < 3 - False

In my opinion, that should evaluate to

  1 < 1 // false

because we have a post-increment operator, and it seems to me that the
expansion defined for Python[1] makes most sense:

> Comparisons can be chained arbitrarily, e.g., x < y <= z is 
> equivalent to x < y and y <= z, except that y is evaluated only once
> (but in both cases z is not evaluated at all when x < y is found to
> be false).

[1] <https://docs.python.org/2/reference/expressions.html#not-in>

-- 
Christoph M. Becker

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

Reply via email to