Question 1 : No, instance variables are only shared in the instance where the "instance" refers to the controller instance, and therefore these variables save only one request (so that User_B will get another @randInt ).
Question 2:: @@ variables are not global variables, $ variables are . @@ are class variables. As the link explains, different computer instances (for example, if you use FCGI) will not use global ( $ ) variables, so do not use them.
If you need global constants, set them in config. Global variables are probably best left in the database (I can see their use, such as site settings, but their use seems to be best suited for use with the database).
You can use class variables as constant instance variables , but again you might be better off using a database to store values such as you are not guaranteed to reload your classes (so reload any class variables).
source share