php share variable among different users/sessions

Store the variable in a shared space like

  • A file

  • A database record (easiest for implementing locking, see below)

  • A memcache bucket

you can easily modify it there. You may need to use some sort of locking mechanism to prevent race conditions when multiple users try to edit the value at the same time.

Leave a Comment