Re: A Few Noob Questions [message #175155 is a reply to message #175154] |
Wed, 17 August 2011 09:50 |
A.Reader
Messages: 15 Registered: December 2010
Karma:
|
Junior Member |
|
|
On Tue, 16 Aug 2011 20:31:30 -0400,
"eBob.com" <eBob(dot)com(at)totallybogus(dot)com> wrote:
> Thank you very much Denis. But now I have to ask ... How global are the
> $GLOBALS? From you answer I assume that $GLOBALS have a scope which exceeds
> one file. But how far beyond one file?
>
> Are there any kind of read/write variables which are shared between users?
I'd suggest avoiding $GLOBALS because it's a bit old and kludgey.
The $_SESSION array is available to all your routines and
persistent within your context --it's automagically saved and
restored between your pages and sessions. So you could have a
number of different programs with different purposes all sharing
the same $_SESSION array.
But your $_SESSION array is not available to anyone else unless
you contrive to make it available, for example by mailing the
other person your persistent session cookie, in effect making
that person a virtual you.
As far as sharing vars between users, I think you'd have to work
at it since one of PHP's goals is that your storage NOT be
available to others.
I've not so far had any need for it, so there might well be a
half-dozen solutions floating around out there, but if I did need
to have shared memory, I'd look into sockets, or shmem if the
users were all served from the same machine. The memory-caching
daemon memcached might be useful too.
|
|
|