I can't figure this one out...
I boiled it down to a test case where I have a bunch of classes and a
demo program:
require_once "L.php";
$l = new L();


require_once "P.php";
require_once "C2.php";

class L extends P{
var $class = "L class";
var $c;

  function L() {
    $this->c = new C2();
    echo "L init\n";

class P {

var $class = "P class";

    function P() {
        echo "P init\n";


class C2 extends L{

var $class = "C2 class";

    function C2(){
        echo "C2 init\n";

so I'm instantiating L,  L is a subclass of P and C2 is a subclass of L.
The contructor for L creates an instance of C2.

I just want users to have to require_once the L class file (L.php) and
not have to think about P.php or C2.php so I include them in L.php

(incase it helps, in real life P is PEAR.php, L is LDAP.php, and C2 is

When I run demo.php I get 
'Fatal error: Class c2: Cannot inherit from undefined class l in C2.php
on line 2'

if I move the 'require_once "C.php";' line from L.php to demo.php I
don't get the error.

can anyone explain what is going on?

      /v\    L   I   N   U   X
     // \\  >Phear the Penguin<
    /(   )\
If it beeps, port Linux to it.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to