Tutorial for Spaceship operators

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:

Example:-

Output:-

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
Tagged : / / / / / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x