Spaceship Operator in PHP

spaceship operator will return -1, 0, 1 according to the values 

 

$a = 10;

$b = 20;

echo $a <=> $b; // return -1

 

 

$a = 10;

$b = 10;

echo $a <=> $b; // return 0

 

 

$a = 20;

$b = 10;

echo $a <=> $b; // return 1

 

About Me
aman-jaiswal-image
Hello! I'm Aman Jaiswal, a web developer passionate about building efficient and reliable web applications. I specialize in PHP and Laravel development and have experience working with clients worldwide through freelance platforms. I enjoy solving real-world problems, customizing web solutions, and continuously learning new technologies in the web development ecosystem.
Let's Discuss Your Project
Prefer email? Contact me directly at contact@amanjaiswal.in