Saurabh Gandhe I am a Coder!

There’s a better way for if($var == 5). It’s ..


Ever wandered which one is correct?

if($var ==5) or if (5==$var)?


Although, you might see a warning in your IDE, it’s unlikely you will get any error for saying if($var = 5) , but if you have a habit of using the other way, you will get an error for assigning variable to constant.


What you use

if($var == 5){}

What you should use


Why you should follow me ?

because, you may do this > if($var=5){}

and only this will generate error > if(5=$var){}

Happy Coding!

Add comment

Leave a Reply

By Saurabh
Saurabh Gandhe I am a Coder!

Contact Hands-on DevOps with Azure/AWS Experience

Want to stay in touch?

Recent Posts


%d bloggers like this: