Hi all,
i am actually developing a quite small php application (one of my first projects in php) and i face a problem i am not able to solve by myself, due to lack of experience.
The problem i face is hopefully quite simple:
i want to be able to refer to a once created instance of a class in script X also out of script Y:
my effort
script :init_all.php (included everywhere):
<?
if(!$GLOBAL_SYSTEM_ENGINE)
{
$GLOBAL_SYSTEM_ENGINE=& new system_engine();
}
?>
script x.php:
<?php
require(init_all.php);
[...]
?>
script y.php:
<?php
require(init_all.php);
[...]
?>
everytime x or y are executed, a new instance of system_engine is created. Thats exactly what i try to avoid.
Is there any way to handle global - only once created - class istances in multiple scripts? Maybe though an superglobal object-container or whatever?
ps: I do not want to use $_SESSION to store objects, too complicated, static and performance-killing i fear.
thanks for any hint, especially also if i am riding the wrong horse.
jochen