note 46877 deleted from language.basic-syntax.instruction-separation by tularis
| From: | tularis@php.net | Date: | Sat, 30 Oct 2004 19:26:40 +0000 |
| Subject: | note 46877 deleted from language.basic-syntax.instruction-separation by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79373@lists.php.net to get a copy of this message | ||
Note Submitter: Chip
----
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.