Why can this method be passed in? Instructions in the PHP Manual

Source: Internet
Author: User
Tags autoloader
Why can methods in the class be passed like this? What are instructions in the PHP manual? PHPcodeclassautoLoader {publicstaticfunctionmyLoader ($ classname) {$ class_filestrtolower ($ classname). & quot;. php & quot; why can methods in the class be passed like this? What are instructions in the PHP manual?
PHP code
  Class autoLoader {public static function myLoader ($ classname) {$ class_file = strtolower ($ classname ). ". php "; if (file_exists ($ class_file) {require_once ($ class_file) ;}}// transmits classes and methods in the form of arrays, element 1 is the class name, element 2 is the method name // method is the static method spl_autoload_register (array ("autoLoader", "myLoader"); $ test = new Test ();


Where can classes and methods be transmitted in the form of arrays in the PHP manual?
PHP code
  // Pass classes and methods in the form of arrays. element 1 is the class name and element 2 is the method name. // The method is the static method spl_autoload_register (array ("autoLoader ", "myLoader "));



------ Solution --------------------
Callback? Class (object) method name must be passed in this way, from php4
As for the manual, no instructions are provided. However, many php conventions are not described in the manual.
After all, the manual is not a textbook

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.