PHP Object-oriented related

Source: Internet
Author: User
PHP construction Method Function__constructz () {

}

PHP5 with destructor function__destruct () {}//cannot have any arguments

Static properties can be declared statically by means of a static method. This is present in memory.

Static methods in a class in PHP can only access static properties, and non-static methods can only access non-static properties.

Self is similar to $this, but self is used to invoke static properties, Self:: Property name (does not point to any instantiated object)

Final is used to define the classes and methods that cannot be used to define member properties. Because final is a constant defined, the constants defined in PHP are define (); The final defined class cannot be inherited. Methods that use final markup cannot be overridden.

Define () defines constants using this function.

Const defines a keyword for a constant in a class.

__tostring () If this is written in the class, Echo can print out the object correctly (that is, which class $pag = new Animal ()) value is referenced.

__clone clones a function that has the same properties.

__call () This is the wrong way to write this method in the class, then we call the non-existent method inside the class will prompt the error, but the program continues to run.

__autoload () automatic loading in the development of the time to include a lot of time to add some files, if you use this method so it is not so troublesome, and then use the time will be automatically loaded

  • 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.