Erm, aren't "extends" what you're looking for?
To accomplish the auto-loading of needed subclasses?

class FOO {
    static $x = 'Hello World';
class BAR extends FOO {
    public $greeting = false;
    public function __construct() {
        $this->greeting = parent::$x;

$test = new BAR();
echo $test->greeting;

Prints out "Hello World".

Sure - the if you put class FOO in a separate file, than you need to
require_once(it) (as often as you need to) - it'll be there.


2009/3/26 Ionut Rusu <>:
> sry to boder you again but i didnt quite understood youre answer, i got the
> part where to add the include files on the top of the file or with
> require_once statment, but i still dont understant how is it posiible to add
> classes to the constructor with the include statment and not trigger a
> nested class error......
> is it corect to add include files( php classes ) to the constructor, and if
> so how does php do it....
> thank you!!!

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to