note 40812 added to function.class-exists

From: Date: Mon, 15 Mar 2004 18:45:31 +0000
Subject: note 40812 added to function.class-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-66877@lists.php.net to get a copy of this message
to: azeps 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!'); } } ---- Manual Page -- http://www.php.net/manual/en/function.class-exists.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40812 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40812&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40812&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66877) next »