note 71155 added to function.spl-autoload-register
| From: | florent at mediagonale dot com | Date: | Tue, 14 Nov 2006 09:19:28 +0000 |
| Subject: | note 71155 added to function.spl-autoload-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119710@lists.php.net to get a copy of this message | ||
If your autoload function is a class method, you can call spl_autoload_register with an array
specifying the class and the method to run.
* You can use a static method :
<?php
class MyClass {
public static function autoload($className) {
// ...
}
}
spl_autoload_register(array('MyClass', 'autoload'));
?>
* Or you can use an instance :
<?php
class MyClass {
public function autoload($className) {
// ...
}
}
$instance = new MyClass();
spl_autoload_register(array($instance, 'autoload'));
?>
----
Server IP: 217.174.203.10
Probable Submitter: 81.50.189.139
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload-register.php
Edit -- https://master.php.net/note/edit/71155
Del: integrated -- https://master.php.net/note/delete/71155/integrated
Del: useless -- https://master.php.net/note/delete/71155/useless
Del: bad code -- https://master.php.net/note/delete/71155/bad+code
Del: spam -- https://master.php.net/note/delete/71155/spam
Del: non-english -- https://master.php.net/note/delete/71155/non-english
Del: in docs -- https://master.php.net/note/delete/71155/in+docs
Del: other reasons-- https://master.php.net/note/delete/71155
Reject -- https://master.php.net/note/reject/71155
Search -- https://master.php.net/manage/user-notes.php