Hi,

I am php noob and I have question about the singleton patter in php. I am not sure how the server handles the different users. If I create a singleton class, is that "single" instance shared among all the different users connecting to the server? are there any situations in which one users can change the value of a variable being used by another user?

Thank you in advance.

Recommended Answers

All 3 Replies

anyone?

Hi,

I am php noob and I have question about the singleton patter in php. I am not sure how the server handles the different users. If I create a singleton class, is that "single" instance shared among all the different users connecting to the server? are there any situations in which one users can change the value of a variable being used by another user?

Thank you in advance.

If I create a singleton class, is that "single" instance shared among all the different users connecting to the server?

You are conflating PHP and web service. They are distinct. Depending on how you have set up your server, it may share the running service among all connections or each connection may have (effectively) its own copy of the code. Nothing directly to do with PHP. By default, connections are distinct (otherwise, chaos is too likely to ensue)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.