In PHP, what does the spaceship operator expression 3 <=> 7 return?
Correct answer
D. -1
14 views
D. -1
14 views
returns −1, 0 or 1 when the left side is less than, equal to or greater than the right. It is handy in usort() callbacks: usort($a, fn($x, $y) => $x $y).
Asked in: NTS, PHP Developer Interviews
Not sure why the answer is D? Ask here and get an explanation.