note 96679 deleted from language.oop5.autoload by crell

From: Date: Mon, 04 Apr 2022 16:14:57 +0000
Subject: note 96679 deleted from language.oop5.autoload by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218039@lists.php.net to get a copy of this message
Note Submitter: tom at r dot je ---- To find out whether a class can be autoloaded, you can use autoload in this way: <?php //Define autoloader function __autoload($className) { if (file_exists($className . '.php')) require $className . '.php'; else throw new Exception('Class "' . $className . '" could not be autoloaded'); } function canClassBeAutloaded($className) { try { class_exists($className); return true; } catch (Exception $e) { return false; } } ?>

« previous php.notes (#218039) next »