What is Spaceship operators?
PHP 7 introduces a new spacecraft operator (=>) for comparing two words. It’s also known as the combined contrast operator.
The spacecraft operator yields 0 if the two operands are equal, 1 if the left is bigger, and -1 if the right is larger. In the following table, the three-way comparison is essentially shown:
![](https://www.devopsschool.com/blog/wp-content/uploads/2021/05/image-28.png)
Example:-
Output:-
![](https://www.devopsschool.com/blog/wp-content/uploads/2021/05/image-29.png)