note 114700 added to function.autoload
| From: | Ben | Date: | Wed, 26 Mar 2014 05:56:08 +0000 |
| Subject: | note 114700 added to function.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199043@lists.php.net to get a copy of this message | ||
Guys, this document ( i mean __autoload() ) not mentioned one special situation: if you both use
__autoload() and spl_autoload_register(), the __autoload() function will never to be called.
Although spl_autoload_register() documentation explained why, i decide to wrote this in case some
one get confused and waste all day to figure out why.
Here is some code to verify above:
<?php
function __autoload($class) {
}
function my_loader() {
}
function your_loader() {
}
var_dump ( spl_autoload_functions () );
echo '<br/>';
spl_autoload_register ( 'my_loader' );
spl_autoload_register ( 'your_loader' );
var_dump ( spl_autoload_functions () );
----
Server IP: 64.71.164.2
Probable Submitter: 220.249.79.2
----
Manual Page -- http://php.net/manual/en/function.autoload.php
Edit -- https://master.php.net/note/edit/114700
Del: integrated -- https://master.php.net/note/delete/114700/integrated
Del: useless -- https://master.php.net/note/delete/114700/useless
Del: bad code -- https://master.php.net/note/delete/114700/bad+code
Del: spam -- https://master.php.net/note/delete/114700/spam
Del: non-english -- https://master.php.net/note/delete/114700/non-english
Del: in docs -- https://master.php.net/note/delete/114700/in+docs
Del: other reasons-- https://master.php.net/note/delete/114700
Reject -- https://master.php.net/note/reject/114700
Search -- https://master.php.net/manage/user-notes.php