Accessing Classes Within Other Classes

I’m having an issue trying to use globals within classes, when I reference the settings class within the db class, my page doesn’t load. Here’s the code:

Initializing File (Includes all related files):

require_once("inc/class_settings.php");
$settings = new Settings();
require_once("inc/functions_db.php");
$db = new DB();

inc/class_settings.php:

class Settings
{
	// Stuff...
}

inc/functions_db.php:

class DB
{
	function __construct()
	{
		// This causes the page to stop loading:
		global $settings;

		// Do stuff...
	}
}

If anyone has any idea of what I’m trying to do, and more importantly a way to actually do it, any help would be greatly appreciated!

Sponsor our Newsletter | Privacy Policy | Terms of Service