note 97140 modified in language.oop5.autoload by danbrown

From: Date: Sat, 03 Apr 2010 19:22:29 +0000
Subject: note 97140 modified in language.oop5.autoload by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167678@lists.php.net to get a copy of this message
You don't need exceptions to figure out if a class can be autoloaded. This is much simpler. <?php //Define autoloader function __autoload($className) { if (file_exists($className . '.php')) { require_once $className . '.php'; return true; } return false; } function canClassBeAutloaded($className) { return class_exists($className); } ?> --was-- You don't need exceptions to figure out if a class can be autoloaded. This is much simpler. <?php //Define autoloader function __autoload($className) { if (file_exists($className . '.php')) { require_once $className . '.php'; return true; } return false; } function canClassBeAutloaded($className) { return class_exists($className); } http://php.net/manual/en/language.oop5.autoload.php

« previous php.notes (#167678) next »