PHP7 Spaceship Operator
PHP7 Improved performance up to twice as fast as PHP 5.6 ,Consistent 64-bit support,Combined comparison Operator (<=>) any many others new features.In here we know how to use php7 spaceship operator(<=>).Let see how to use it.
PHP7 Spaceship Operator(<=>)
This <=> operator will offer combined comparison in that it will : Return 0 if values on either side are equal Return 1 if value on the left is greater Return -1 if the value on the right is greater // Integers echo 1 <=> 1; // 0 echo 1 <=> 2; // -1 echo 2 <=> 1; // 1 // Floats echo 1.5 <=> 1.5; // 0 echo 1.5 <=> 2.5; // -1 echo 2.5 <=> 1.5; // 1 // Strings echo "a" <=> "a"; // 0 echo "a" <=> "b"; // -1 echo "b" <=> "a"; // 1