duomax Posted April 29, 2008 Share Posted April 29, 2008 The problem is this, I want an object that different users can access. In java, this would be done with a singleton that all users can access. Now, it's important that all the users access the SAME object. Meaning, all the users aren't accessing an object of the same type, but the exact same object data and all. Now, I looked up the singleton pattern for PHP, but it appears that the singleton created is only accessible to the current user and the object is collected after the page is generated. Is seems that the lifetime of all variable types ends after a page is generated. My question is now, is there a way for an object to be shared by multiple users in PHP. Meaning, once one user tries to access the object it's created and then when future users try and get that object, they get the same one that was created. Thanks for your help in advance Link to comment https://forums.phpfreaks.com/topic/103420-static-persistent-objects-in-php/ Share on other sites More sharing options...
DarkWater Posted April 29, 2008 Share Posted April 29, 2008 Every HTTP request is a seperate, unrelated entity. So not really. Link to comment https://forums.phpfreaks.com/topic/103420-static-persistent-objects-in-php/#findComment-529596 Share on other sites More sharing options...
dptr1988 Posted April 29, 2008 Share Posted April 29, 2008 There is nothing in PHP that I know of that will be shared between multiple users. The best PHP has is sessions, which are only shared between page requests for the same user. Link to comment https://forums.phpfreaks.com/topic/103420-static-persistent-objects-in-php/#findComment-529598 Share on other sites More sharing options...
duomax Posted April 29, 2008 Author Share Posted April 29, 2008 I was thinking it was impossible. But, quickly what exactly is an entity? I tried googling it, but didn't really get a decent result. I assume it means that each request is essentially in its own little sandbox, but something a little more technical would be nice. Thanks for the quick replies guys Link to comment https://forums.phpfreaks.com/topic/103420-static-persistent-objects-in-php/#findComment-529599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.