note 40813 deleted from function.class-exists by curt

From: Date: Fri, 02 Jul 2004 02:35:38 +0000
Subject: note 40813 deleted from function.class-exists by curt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72297@lists.php.net to get a copy of this message
Note Submitter: anonymous ---- to: Jazeps Basko I assume by crush you mean crash. I've never had php crash except when trying to use a module that was ment for a different php version causing php to seg fault. Syntax error != crash Your section of code has a problem: for ( $i=0; $i<sizeof($paths) && !$found; $i++ ) { include_once($paths[$i]); $found = class_exists($class); } if ( !$found ) { die('Oops, class '.$class.' definition not found!'); } the !$found check will only check the *last* value of $found that was set you really want: for ( $i=0; $i<sizeof($paths) && !$found; $i++ ) { include_once($paths[$i]); $found = class_exists($class); if ( !$found ) { die('Oops, class '.$class.' definition not found!'); } }

« previous php.notes (#72297) next »