It happens that, when writing some PHP code, I accidentally put a semicolon ; right after an if statement. For example:
if($a > 1);
{
....
}
I thought that PHP should raise an error in this case, but it is not. That kind of syntax should have a meaning, I’m just wondering what it is.
For what I could see the condition seems to be always true when the ; is added but I’m not sure at all this is the meaning.
A single
;can be read as an “empty statement” andis equivalent to
It only seems like it since the block is executed regardless of the if-statement.