Re: OOP, dynamic class extention

From: Date: Thu, 30 Oct 2003 19:37:35 +0000
Subject: Re: OOP, dynamic class extention
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-168173@lists.php.net to get a copy of this message
On Thursday 30 October 2003 01:27 pm, Marek Kilimajer wrote: > Why? I guess because php is interpreted language and is parsed only > once, no preprocessor. Workaround is quite easy, use variable: I thought that too, and tried it before posting to the list (it was at the bottom of my first email). Unfortunately when you do that you get and expecting T_STRING error. The same thing happens if you put the var in quotes. Why would it not parse the constant the first time? It does everywhere else. -Jackson > > <?php > > // settings to be set on install of the app > $MY_BASE_CLASS="base_class"; > define("MY_BASE_CLASSFILE","base_class.php"); > > // require the class file > require_once(MY_BASE_CLASSFILE); > > class my_child_class extends $MY_BASE_CLASS { > // yada yada > } > ?> > > Jackson Miller wrote: > > On Thursday 30 October 2003 12:29 pm, Marek Kilimajer wrote: > >>php is not c, you can't use constants this way. > > > > but why? Is there a work around? > > > > -Jackson

« previous php.general (#168173) next »