note 23924 added to function.class-exists
| From: | patrick dot pasteels at pi dot be | Date: | Thu, 01 Aug 2002 15:12:15 +0000 |
| Subject: | note 23924 added to function.class-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34090@lists.php.net to get a copy of this message | ||
To avoid the "Cannot redeclare class"-error, you can use
require_once ("ClassName");
instead of require ("ClassName");
If you use this, PHP doesn't try to declare the class a second time.
Even easier to use than:
if ( !class_exists( YourClass ) )
as stated in the previous message.
--
http://www.php.net/manual/en/function.class-exists.php
http://master.php.net/manage/user-notes.php?action=edit+23924
http://master.php.net/manage/user-notes.php?action=delete+23924
http://master.php.net/manage/user-notes.php?action=reject+23924