note 75428 added to function.spl-autoload-register
| From: | NayanaHettiarachchi | Date: | Tue, 29 May 2007 22:53:28 +0000 |
| Subject: | note 75428 added to function.spl-autoload-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127002@lists.php.net to get a copy of this message | ||
The documentation maybe not clear, so i hard little hard time figuring this out, just incase if you
had problems registering few autoload functions using this method please not that your custom
functions should return true when it sucesfully did the autoload task and false when it did not.
The documentation says "When registering is successful the return value is true and upon
failure false is being returned." but i don't think its related.
small example
<?php
function myload($classname)
{
$file = some_logic_to_obtain_the_file_from($clasname);
if(file_exists($file) {
require_once($file);
return true;
}
return false;
}
spl_autoload_register('myload');
?>
----
Server IP: 64.71.164.2
Probable Submitter: 67.183.241.214
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload-register.php
Edit -- https://master.php.net/note/edit/75428
Del: integrated -- https://master.php.net/note/delete/75428/integrated
Del: useless -- https://master.php.net/note/delete/75428/useless
Del: bad code -- https://master.php.net/note/delete/75428/bad+code
Del: spam -- https://master.php.net/note/delete/75428/spam
Del: non-english -- https://master.php.net/note/delete/75428/non-english
Del: in docs -- https://master.php.net/note/delete/75428/in+docs
Del: other reasons-- https://master.php.net/note/delete/75428
Reject -- https://master.php.net/note/reject/75428
Search -- https://master.php.net/manage/user-notes.php