Originally Posted by HarryR
I doubt concurrency in PHP would be very hard to implement (although a little tedious). An 'application scope' variable would be great - like the $_SESSION variable, but accessable to all PHP applications running on the same server. for exaxample:
application_register ('users');
$_APPLICATION['users']++; // When the session starts
// TODO: implement logic
$_APPLICATION['users']--; // And again when it ends
To deal with concurrency, you'd have to register variables independantly so that you you can assign a mutex to it, which solves the concurrency issue. I'm not sure how you'd be able to keep track of a mutex accross multiple processes (e.g. apache prefork), but it'd be trivial for the multi-threaded apache mode.
This could open up a large number of possibilities, like initializing a class that would normally take a long time to do (e.g. keeping oftenly used data from a database, or a list of concurrent clients). I'll experement & see if I can hackup a quick implementation (dont expect anything soon).
Just my $0.02