Beginner PHP
Q29 / 100

What is the PHP spaceship operator <=>?

Correct! Well done.

Incorrect.

The correct answer is B) Returns -1, 0, or 1 for less-than, equal, or greater-than comparisons

B

Correct Answer

Returns -1, 0, or 1 for less-than, equal, or greater-than comparisons

Explanation

$a <=> $b returns -1 if $a < $b, 0 if equal, 1 if $a > $b. Added in PHP 7, useful for usort() callbacks.

Progress
29/100