Conditional statements with empty conditions
I ran into this issue, but detected it by accident.
The following I believe will work.
if($something ==)
{
print("hi");
}
?>
This was suppose to say if($something == "yes"), however it didn't trigger an error in my application. I suppose it was checking that $something was NULL, but I'm not sure.
The way to ensure this won't happen is to reverse the statement.
if(== $something)
{
print("hi");
}
?>
Actually, this is to prevent errors by using good coding practices. The above would never make sense, because there needs to be something for $something to equal.
In the example above, by putting values on the left and variables on the right, you can prevent these kind of errors in the future.
[Click to add or edit comments])
Please prepend comments below including a date