I'm practicing some code in PHP when I come across this:
<?php
$a = (object) ["a" => "b"];
$b = (object) ["a" => "c"];
$y = $a <=> $b;
echo $y;
$v=[1,2,3] <=> [1,2,3];
echo $v;
$a= (object) ["a" => "b"];
$b = (object) ["a" => "b"];
echo $a <=> $b;
echo ($y == -1)? 1:0;
?>
As long as I do not practice PHP my doubts are as follows:
Because the outputs of the first three echo
are, respectively,
-1,0,0
?
How do I do this% type conversion to object?
What is the name of this ["a" => "b"]
? comparison operator? Equality? I searched
in <=>
I did not find anything about it.