If I create a registry object to store other objects and settings in like this…
$registry = Registry::getInstance();
And then create 2 other objects and pass the Registry object into them like this below…
$core = new core($registry);
$database = Database::getInstance($registry);
and then later in the script I add some objects to the Registry object…
// Store some Objects into our Registry object using a Registry Pattern
$registry->storeObject("database", $database);
$registry->storeObject("session", $session);
$registry->storeObject("cache", $cache);
$registry->storeObject("user", $user);
Will methods in the core and database objects that were created at the top, still have access to all the objects that I store into the registry even though the other objets were stored into the registry AFTER the core and database Objects were created?
yes they will, objects are passed by reference (in php >= 5) so, each variable will refer to the same underlying object.
in old php, you would need to pass by ref:
the key in php <5 is the ampersand syntax when assigning and in function declarations.