note 49425 deleted from language.oop5.autoload by cmb
| From: | cmb@php.net | Date: | Sun, 26 May 2019 09:04:33 +0000 |
| Subject: | note 49425 deleted from language.oop5.autoload by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211123@lists.php.net to get a copy of this message | ||
Note Submitter: thomas dot revell at uwe dot ac dot uk
----
If you want to throw an exception if a class isn't defined yet, use class_exists ():
<?php
// See if the class is defined
if (!class_exists ($className, false)) {
throw new Exception ("Class $className is not defined.");
}
?>
The second parameter indicates whether or not the __autoload () function should be called before
checking for the class's existence.