faqts : Computers : Programming : Languages : PHP : kms : General

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 16 people (75%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Are static variables preserved across queries to PHP?

Jun 17th, 1999 07:00
Nathan Wallace, Nathan Wallace, Sascha Schumann


No.

Every request to PHP is executed completely independently.  Static
variables are static only for the current request.

If you want to store data across requests you need to use files, a
database or shared memory.

http://www.php.net/manual/variables.php3

PHPLIB is a great place to start if you are trying to create sessions
on your site and store data across requests.

http://phplib.shonline.de/