Complete the code to compare two numbers using the spaceship operator.
<?php $result = 5 [1] 3; echo $result; ?>
The spaceship operator <=> compares two values and returns -1, 0, or 1.
Complete the code to compare two variables using the spaceship operator.
<?php $a = 10; $b = 20; $result = $a [1] $b; echo $result; ?>
The spaceship operator <=> compares $a and $b and returns -1 because 10 is less than 20.
Fix the error in the code by replacing the incorrect operator with the spaceship operator.
<?php $x = 7; $y = 7; $result = $x [1] $y; echo $result; ?>
The spaceship operator <=> returns 0 when both values are equal.
Fill both blanks to create a dictionary that maps numbers to their comparison result with 10 using the spaceship operator.
<?php $numbers = [8, 10, 12]; $results = [ [1] => [2] <=> 10, 10 => 10 <=> 10, 12 => 12 <=> 10 ]; print_r($results); ?>
The key is 8 and the value is the result of 8 <=> 10 using the spaceship operator.
Fill all three blanks to create an array that stores the comparison results of each number with 15 using the spaceship operator.
<?php $values = [10, 15, 20]; $comparisons = [ [1] => [1] <=> 15, {{BLANK_3}} => {{BLANK_3}} <=> 15, 20 => 20 <=> 15 ]; print_r($comparisons); ?>
The keys are 10 and 15, and the values are the result of comparing each key with 15 using the spaceship operator.