note 100395 added to language.oop5.autoload

From: Date: Wed, 13 Oct 2010 10:11:50 +0000
Subject: note 100395 added to language.oop5.autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-173183@lists.php.net to get a copy of this message
Example #1 would be better as: function __autoload($class_name) { include $class_name . '.php'; } Making it an include rather than a require makes it a warning if the file fails to load rather than a fatal, and PHP will instead fatal where the class is being used. The net result is that the error logs will report the actual source of the error rather than pointing to the autoloader. Removing the _once just makes it slightly more efficient since _once is not necessary inside of __autoload because it will only try to load a class if it's not already defined. More info: http://p3n.us/q7 ---- Server IP: 69.147.83.197 Probable Submitter: 98.180.3.94 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php Edit -- https://master.php.net/note/edit/100395 Del: integrated -- https://master.php.net/note/delete/100395/integrated Del: useless -- https://master.php.net/note/delete/100395/useless Del: bad code -- https://master.php.net/note/delete/100395/bad+code Del: spam -- https://master.php.net/note/delete/100395/spam Del: non-english -- https://master.php.net/note/delete/100395/non-english Del: in docs -- https://master.php.net/note/delete/100395/in+docs Del: other reasons-- https://master.php.net/note/delete/100395 Reject -- https://master.php.net/note/reject/100395 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#173183) next »