note 22598 modified in function.class-exists by vrana

From: Date: Tue, 17 Aug 2004 14:55:01 +0000
Subject: note 22598 modified in function.class-exists by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79829@lists.php.net to get a copy of this message
This can be veeeery usefull if you use classes that uses other classes, which can be used in your front end. In other words, when you lost the control of which classes are declared in which point of the application, that can generate the "Cannot redeclare class". Use like <?php if ( !class_exists( "YourClass" ) ) { class YourClass { //your code } } ?> Thats it... Resolve all your problems =) --was-- This can be veeeery usefull if you use classes that uses other classes, which can be used in your front end. In other words, when you lost the control of which classes are declared in which point of the application, that can generate the "Cannot redeclare class". Use like if ( !class_exists( YourClass ) ) { class YourClass { //your code } } Thats it... Resolve all your problems =) http://php.net/manual/en/function.class-exists.php

« previous php.notes (#79829) next »