Re: Removing a declared class

From: Date: Fri, 15 Dec 2000 01:31:41 +0000
Subject: Re: Removing a declared class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30430@lists.php.net to get a copy of this message
You can check if a class exists or not using... errr. I forget what it's called. It's in the manual though. class_exists()? I don't think you can destroy a class though. It sounds like you have an include() problem more than a class problem. For complex sites, I tend to start off include files like this: <?php if (!is_defined('filenameinc')){ define('filenameinc', 1); #real code goes here... } ?> Replace filenameinc with the actual name of the file and extension or whatever you like -- just make sure it's unique is the key. Now, it really doesn't matter how many times you include that file -- only the first one is going to do anything. There is also a builtin include_once() function, but it may be undocumented and/or only in recent versions... ----- Original Message ----- From: Paul K Egell-Johnsen <pkej@ez.no> Newsgroups: php.general Sent: Thursday, December 14, 2000 5:06 PM Subject: [PHP] Removing a declared class > I'm writing an article which compares some classes through an adaptor. > > Problem: > > Declaring the common adaptor will only work for the first time, later on > I get a message saying that I can't redeclare the adaptor class. > > Question: > > Is there a function (I've tried unset) which can remove a declared > class? > > Solution: > > I moved some includes about, and it worked fine for me, though I still > feel that the question is relevant. > -- > Paul K Egell-Johnsen > Developer/PR Manager > zez.org: about code > http://zez.org/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#30430) next »