Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static variables across sessions

Tags:

php

session

In ASP.NET if I declare a variable (or object) static (or if I make a singleton) I can have it persist across multiple sessions of multiple users (it it registered in a server scope) so that I don't have to initialize it at every request.

Is there such a feature in PHP? Thanks

like image 862
pistacchio Avatar asked Mar 18 '10 17:03

pistacchio


1 Answers

You can set up APC and use the apc_store and apc_fetch functions.

http://us.php.net/manual/en/book.apc.php

like image 53
webbiedave Avatar answered Oct 15 '22 16:10

webbiedave