php7 <=> spaceship operator

Spaceship operator(<=>) also know as Combined Comparison Operator. Basically this operator will offer combined comparison means, it will do greater-than, less-than and equal comparisons between two operands.Below are the return values based on the result.

1. Return 0 if operands on both side are equal.
2. Return 1 if operand on the left is greater.
3. Return -1 if the operand on the right is greater.

It can be used on any two operands like strings,integers,objects, float, Array..etc.

Here are some examples:

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.