DevHeads.net

Is it an error?

Under address:
<a href="http://php.net/manual/en/language.operators.comparison.php" title="http://php.net/manual/en/language.operators.comparison.php">http://php.net/manual/en/language.operators.comparison.php</a>

Is:
// only values are compared
$a = (object) ["a" => "b"];
$b = (object) ["b" => "b"];
echo $a <=> $b; // 1

?>
Shouldn't be?:
// only values are compared
$a = (object) ["a" => "b"];
$b = (object) ["b" => "b"];
echo $a <=> $b; // 0

?>
If we compare values b and b is the same...

Thanks for reply.

dj.drezyna

Comments

Re: Is it an error?

By Christoph Becker at 08/08/2018 - 09:54

The result is correct, but the comment is wrong. This is fixed in SVN
now[1].

Thanks for reporting this issue. Please, use <https://bugs.php.net/>
next time.

[1] <http://svn.php.net/viewvc?view=revision&revision=345447>