11-17-2008, 01:28 PM
|
#1 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Another thought..
Heya!
Here I am again, with one of those thoughts..
Basicly, is it possible to do this:
php Code:
<?php class core { private $class; public $settings = array(); public function loadClass ($name) { $class = new $name($this); return $class; } } class test { private $core; public function __construct($core) { $this-> core = $core; } public function getSettings () { return $this-> core-> settings; } } $core = new core (); $settings = array('website' => 'TalkPHP', 'username' => 'Tanax', 'email' => 'Tanax.ms@gmail.com'); $core-> settings = $settings; $test = $core-> loadClass('test'); var_dump($test-> getSettings()); ?>
Cause I need a baseclass(like a core) with all the settings. Then I have all kinds of other classes that I can load via the core. But I also need to be able to access properties and functions FROM the core INSIDE the other classes.
So can I do this?
And I know I can use extend to get similar functionality. But I'm wondering if THIS is possible.
Thanks in advance!
__________________
|
|
|
|