If I am setting a cookie, that means php program will create a cookie on client side in some file. This cookie will be in form of some text.
If same php program is executed for different requests from different clients, then will the same cookie be created for all different clients ? By that I mean , will all users have same cookie on their computers ?
If not, then how is that possible ? Because its the same program which is executed and creates cookie, which should be of same value for all clients.
It will have the same value for each client if that's what you respond with to each request, and the client's settings are configured to accept cookies from that domain. (Almost all will at least accept cookies from the same sub-domain.domain as that to which the originating HTTP request was made, but those settings are all user configurable at the client side.) As to how exactly they are stored on each client computer, that's entirely up the the client application (browser) and any configuration options that might apply to it (perhaps it encrypts or compresses them in some way?).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation