note 111904 deleted from language.oop5.static by aharvey
| From: | aharvey@php.net | Date: | Thu, 11 Apr 2013 00:04:18 +0000 |
| Subject: | note 111904 deleted from language.oop5.static by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194440@lists.php.net to get a copy of this message | ||
Note Submitter: pgrigsch at gmail dot com
----
if i do static variable in the function it will be global for it.
function first() {
static $var = 4;
return $var++;
}
function second(){
static $var = 10;
return $var;
}
echo first().'-'.second().'-'.first();
//will output:
// 4-10-5