I am at a point of deciding how to handle something rather important in my project. Passing objects and variables in a global scope is required. However, I have been trying to decide which approach to use: globals or registry objects.
A registry object basically holds the global variables:
Code: Select all
$reg = new registry;
$reg -> set('name' => 'val');
echo $reg -> get('name');Code: Select all
$GLOBALS['name'] = 'val';
echo $GLOBALS['name'];How do you handle globals in your project. For instance, if you have a DB class that utilizes a cache class, do you just do "global $cache;" or what?