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:-

Latest posts by Ashwani K (see all)
Tagged : / / / / / / /

Leave a Reply