Register Now

Login

Lost Password

Enter your email to reset your password.

In PHP 7, a new feature “Spaceship Operator” has been included. It is used to compare two expression together.

The spaceship operator is a combination of comparison operators and denoted by “<=>”. Spaceship operator performs greater than, less than and equal comparison between two operands.

  • Returns -1, when the value of first operand is less than the value of second operand.
  • Returns 0, when the value of first operand is equal to the value of second operand.
  • Return 1, when the value of first operand is greater than the value of second operand.

Spaceship operator can be used with integers, floats, strings, array or objects etc.

Leave a reply