note 46877 added to language.basic-syntax.instruction-separation
| From: | Chip at osu1 dot php dot net | Date: | Tue, 26 Oct 2004 19:54:22 +0000 |
| Subject: | note 46877 added to language.basic-syntax.instruction-separation | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79137@lists.php.net to get a copy of this message | ||
This is not correct - instructions are separated in php similarly to Perl and C (or Java), but not
in exactly the same way. In C or Perl, semicolons are optional statement separators. A statement
in C or Perl can be terminated with a semicolon, but it can also be terminated with a closing brace.
For example, the following is valid (although useless) in both C and Perl:
if (1) {
2 + 3
}
In a language like Java, semicolons are required statement terminators, and must be included at the
end of all statements. PHP is also this way - closing braces do not terminate statements. In Java
and PHP, the above code must be written:
if (1) {
2 + 3;
}
As stated in the text, PHP statements can also be terminated by the PHP closing tag (?>), which
is PHP's own special exception to the semicolon rule.
----
Manual Page -- http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46877
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46877&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46877&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46877&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46877&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46877&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46877&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46877&report=yes
Search -- http://master.php.net/manage/user-notes.php