consider the following code...
if ($condition); // <-- do not miss semicolon here!
{
//...
}
After that code inside block works. Can som
I would recommend you to read the manual here:
http://php.net/manual/en/control-structures.if.php
To you question directly why: you don't get a syntax error
?
->Simple because there is no syntax error!
Your code is correct and means this:
if ($condition) ;
// ^condition ^if true execute that line
//same as
if ($condition)
;
//same example with other line if the condition is true
if ($condition) echo "true";
if ($condition)
echo "true";
So your line which gets executed if the condition is true is this: ;
and means nothing.
it's the same as: ;;;;;
It's just nothing!
In most of the time you use a if statement like this:
if ($condition)
echo $result;
if ($condition) {
echo $result;
}
if ($condition) echo $result;