note 98762 added to function.spl-autoload
| From: | daniel at osu1 dot php dot net | Date: | Tue, 06 Jul 2010 02:58:05 +0000 |
| Subject: | note 98762 added to function.spl-autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170724@lists.php.net to get a copy of this message | ||
Note this function will LOWERCASE the class names its looking for, dont be confused when it cant
find Foo_Bar.php
also, unlike most other autoloader code snippets, this function DOES NOT translate underscores to
slashes.
class Foo_Bar {}
will load foo_bar.php and will not try to load foo/bar.php
You can get around this with
spl_autoload_register(function($class) { return spl_autoload(str_replace('_',
'/', $class));});
----
Server IP: 69.147.83.197
Probable Submitter: 74.162.173.91
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload.php
Edit -- https://master.php.net/note/edit/98762
Del: integrated -- https://master.php.net/note/delete/98762/integrated
Del: useless -- https://master.php.net/note/delete/98762/useless
Del: bad code -- https://master.php.net/note/delete/98762/bad+code
Del: spam -- https://master.php.net/note/delete/98762/spam
Del: non-english -- https://master.php.net/note/delete/98762/non-english
Del: in docs -- https://master.php.net/note/delete/98762/in+docs
Del: other reasons-- https://master.php.net/note/delete/98762
Reject -- https://master.php.net/note/reject/98762
Search -- https://master.php.net/manage/user-notes.php