[recursion][class]Define recursive class

admin

Administrator
Staff member
Is that possible to define in PHP a class C1 in terms of a class C2 defined in terms of class C1?
The simplest example coming to my mind is tree: the most simple way to define
a tree is ay that is something plus an array of trees.
May be it seems a bit strange, for there's no type definition in PHP, but if you really need something like this you clash against the "cannot redeclare error" wall, for you should in class C1 include (or require_once) class C2, and in class C2 you should do the same with class C1, then even require_once fails.
I thought I missed something, I've read the Php book, but it do not helps.
Any escamotage could be my rescue.
Maxxx
 
Top