RE: [PHP] Globals
| From: | James Moore | Date: | Sun, 20 Aug 2000 11:23:17 +0000 |
| Subject: | RE: [PHP] Globals | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12643@lists.php.net to get a copy of this message | ||
> Php supports static variables? As in variables that remain set inside a
> function and have the value from the first function call when called a
> second time?
Yep,
<?
function counter() {
static $count = 0;
return ++$count;
}
echo counter()."\n";
echo counter()."\n";
echo counter()."\n";
?>
========= Output =========
1
2
3
==========================
James
--
James Moore