Re: php4 classes, extending same class

From: Date: Mon, 23 Aug 2004 14:59:17 +0000
Subject: Re: php4 classes, extending same class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194475@lists.php.net to get a copy of this message
* Mnp <mnp4ever@gmail.com>: > I have the following classes being inherited: > > User extends School > > I have two classes: > Profile extends User > and > Buddies extends User > > being used in the same .php file. I get a "Fatal error: Cannot > redeclare class school in ..." > > > I can see why this is happening but three questions, > > 1. Does php5 allow for multiple extends? e.g. Profile extends User > extends School I don't believe so; however you can read for yourself at: http://www.zend.com/php5/articles/engine2-php5-changes.php > 2. Programmatically, how can I resolve this sort of issue besides not > using this class and making a new class with a different name? This *should* work. Are you including/requiring the user and/or school class file more than once? > 3. Is there a way to uninclude a included file? No... but if you're not using require_once or include_once when loading your libraries, you're going to see stuff like this (hence my question after your point 2). My suspicion is that you're not using require_once or include_once, and the school class file is getting loaded twice. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:matthew@garden.org | http://vermontbotanical.org

« previous php.general (#194475) next »