[php-langspec][Issue #191] - Array Comparison
[email protected] Fri, 03 Feb 2017 23:06:20 +0000
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
You can view the Issue on github:
https://github.com/php/php-langspec/issues/191
Opened By: Fleshgrinder
Issue Description:
In note 5. about array comparison the following is stated:
> If the next key in the left-hand operand does not exist in the right-hand operand, the arrays cannot be compared and `FALSE` is returned.
This is actually not true in case of the spaceship operator on both PHP and HHVM.
```php
<?php
$lhs = [0 => 0];
$rhs = [1 => 1];
var_dump(
$lhs < $rhs,
$lhs <= $rhs,
$lhs <=> $rhs,
$lhs >= $rhs,
$lhs > $rhs
);
/*
bool(false)
bool(false)
int(1)
bool(false)
bool(false)
*/
```