Jump to content

How do I include a variable in each PHP page


Recommended Posts

I want to include a variable (for example an object $user) in each PHP page.


Previously I declared $var in an include file then included that file in every page, however it generates an error in Zend Studio and it's also not very good programming style.


I want to know how I can do it any other way.  I was thinking of using constants but I don't know if constants should be used for this purpose and also I do not think constants can be defined as objects.


Thank you very much for your help.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.