I'm developing an e-commerce site involved with a lot of database access and naturally I want to keep the DB access to a minimum. Keeping some information in a server buffer definitely helps. I do have about 10 PHP script files for the entire site. Do you know if variables declared outside of functions in PHP modules are considered as global variables and accessible from any executing PHP scripts? Thanks, Warren
Each request for a PHP script is executed in a pristine VM. There is not a native method for stateful preservation of values between requests except persistence such as databases, memcached, APC, etc. To directly answer your question: global variables are only accessible to the main execution of the byte code compiled scripts which are needed for for the individual request. They are not shared between requests.