Re: if syntax
| From: | Martin Clifford | Date: | Wed, 10 Jul 2002 14:29:03 +0000 |
| Subject: | Re: if syntax | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-106810@lists.php.net to get a copy of this message | ||
There are no brackets necessary if you only have one line of code to be executed in the case. For
example:
if($var == 1)
echo "Var equals 1";
} else {
echo Var does not equal 1";
}
But this is not valid:
if($var == 1)
echo "Var equals ";
echo "1";
} else {
....
}
HTH
Martin
>>> "Alexander Ross" <alexross@bleen.net> 07/10/02 10:25AM >>>
I know this is correct:
if ($something)
{
...
}
else
{
...
}
But I recently saw someone use this instead:
if($something):
...
else:
...
Is that also correct?? No brackets needed?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php