There’s no actual difference. The second one is used to defend yourself from typo if ($var="value")
But not really readable. Use mostly the first one unless you are so tired that while typing you miss characters.
If you write code
if ($var="val") echo $var; //Output will be "val"
but if you do
if ('val' = $var) echo $var;
You’ll get syntax error.