View Single Post

  #2 (permalink)  
Old 10-19-2004
Berislav Lopac
 
Posts: n/a
Default Re: defining a class/instantiating object inside a method of another class

On Tue, 19 Oct 2004 04:07:11 GMT, Lüpher Cypher wrote:

> Taking the whole thing outside of the class definition is not going to
> work - suppose I have many subclasses of this class, each with its own
> file, then for every class I'd have to provide a separate function
> outside the class definition to read the file.


No, just include the class definition file anywhere, even inside the
function block. As PHP is parsed and compiled before it's executed, class
definitions are valid for whole program, regardless of where they are
defined.

Berislav
Reply With Quote