note 48099 deleted from language.oop5.autoload by cmb

From: Date: Sun, 26 May 2019 09:08:04 +0000
Subject: note 48099 deleted from language.oop5.autoload by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211126@lists.php.net to get a copy of this message
Note Submitter: nhartkamp at eljakim dot N0SP4M dot nl ---- The following might provide a good work-around for throwing exceptions from the __autoload function when a file containing the correct class doesn't exists. function __autoload ($class_name) { $file = 'system/objects/' . $class_name . '.inc.php'; if (!file_exists ($file)) { return eval ("class $class_name {" . " function $class_name () {" . " throw new Exception ();" . " }" . "}"); } require_once ($file); } Cheers, Nolan

« previous php.notes (#211126) next »