PHP static variables

From: Date: Sun, 20 Mar 2005 23:58:02 +0000
Subject: PHP static variables
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-27719@lists.php.net to get a copy of this message
In examples 12-4, 5 and 6 on the web page at http://www.php.net/manual/en/language.variables.scope.php, an attempt is made to explain the workings of static variables in PHP. As I am not a PHP programmer, I am unsure if the examples given are bad or whether the explanation given is a bit incomplete. From the example (12-5 and 6), I must assume that the declaration statement: " static $a = 0; " only occurs once. That in future invocations of the function (during the current active session) the declaration statement with the initial assignment of the variable is ignored. Else, would not the variable be reset to the assigned value? Wishing to know, Stuart M Klimek (dejmar@att.net)

« previous php.mirrors (#27719) next »