For Programmers: Free Programming Magazines  


Home > Archive > PHP Mirrors > March 2005 > PHP static variables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP static variables
Stuart M Klimek

2005-03-21, 3:56 am

In examples 12-4, 5 and 6 on the web page at http://www.php.net/manual/en/langua...bles.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)
Gabor Hojtsy

2005-03-21, 8:55 am

Please submit documentation problems at http://bugs.php.net/ (as
Documentation Problem), so that the doc team can act on your suggestion.

Goba

Stuart M Klimek írta:
> In examples 12-4, 5 and 6 on the web page at http://www.php.net/manual/en/langua...bles.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 wh

ether the explanation given is a bit incomplete.
> 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)

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com