I have a PHP webpage containing several php scripts. In the first script I create an object, which is needed by all scripts. In general I want to avoid globals, so how can I send an object from one script to another script?
My first point of thought was to use $_SERVER['object']=$myobject
. But I realized that this is not working.
So I'm looking for another solution.
In the past years I used PHP_SELF
, but that was used in forms. In this case I do not have any forms and this object is created before a session is started and will be uses also outside sessions. Is there another option?