Is it possible to have true global variables in PHP? The tests I have done so far seem to suggest that you can have a global variable that is global only to the php file that declares it and not to your whole website. Once you go to another php file, the variable seems to loose what you assign it.
Yes, globals are set within a PHP instance... not for your entire site. You would have to use cookies or a session to retain information stored in variables.
Hello, If security is not a concern, you can also use a flat file to store and retrieve data (variables) across the site, eg. a config file or xml file etc. The best way is to use cookies or sessions. Regards, Gonzo