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