I was checking out the New Features of PHP 7 and I came across an operator, which I had never seen in any programming language. The PHP Manual has demon- strated it from Spaceship Operator
.
I'll show you what I've seen below:
echo 1 <=> 1; // 0
echo 1 <=> 2; // -1
echo 2 <=> 1; // 1
I do not know if I understood correctly, but it seems to me that it does the same thing as strcmp
.
- After all, what is the purpose of this operator simplified?
- What are the benefits of using it?