"global" need terminating semicolon or not?
| From: | Paul DuBois | Date: | Fri, 02 Jun 2000 16:44:35 +0000 |
| Subject: | "global" need terminating semicolon or not? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-911@lists.php.net to get a copy of this message | ||
Is "global" a special kind of statement in not needing a trailing
semicolon? The following script prints the values of $x and $y
just fine, and no parse error occurs. If I leave off the semicolon
on either assignment statement or either print statement, I get a
parse error. This is with PHP 4.0.0.
<?php
$x = 1;
$y = 2;
function z ()
{
global $x
global $y
print "x = $x\n";
print "y = $y\n";
}
z();
?>
--
Paul DuBois, paul@snake.net