Posted by Chung Leong on 05/07/06 19:41
Paul Czubilinski wrote:
> Hi Chung,
> include('B.php');
> $a = new A();
> class A extends B {....}
This doesn't work because include() is a runtime operation. B.php
doesn't just get inserted into A.php. The behavior is somewhat like a
function call.
While compiling A.php, PHP doesn't know what B is. Therefore the
definition ("binding" to be more precise) of A has to be done at
runtime. And as new A() occurs before class A {} in the code, the
operation fails.
Navigation:
[Reply to this message]
|