Global Variable with a dynamic value set by variable_get() in multisite My question is, if I have a multisite environment what is the expected behaviour of global variables set like:

define('GLOBAL_VARIABLE' , variable_get('myvar'));


'myvar' is set in a module configuration page, all the sites share the same module. 
Will each site use an independent value for 'GLOBAL_VARIABLE'? Which is what I want, each site to have different values for these global variables.

I can't seem to find any documentation on how this would work, or any previous questions either. It's something that would significantly affect how my module is structured, as there's a rather large amount of customization settings.

Any input is greatly appreciated.
If you are running true multisite, then your sites are sharing the same code, but not the same database catalogs.

If you are in a situation where you only have access to a single database catalog, then you can use prefixes to keep all of your instances separate.

It is also possible to share tables in the same database catalog between multiple sites.  This is primarily meant for the {users} table, and cousins.  Sharing anything else, is likely a recipe for disaster.

So, to answer your question, the {variables} tables in a true multisite instance will be distinct unless you went out of your way to share them.

If you are using the Domain Access module to share some content between sites, then everything is really in the same database, and you will have a single {variables} table.

Now, you have the sample code

define('GLOBAL_VARIABLE', variable_get('myvar'));


This is not really a good idea; just use variable_get('myvar') wherever you need it.  If you have a lot of settings, then I would consider wrapping everything up in a singleton with a getter function that uses drupal_static().