Php object-oriented

Source: Internet
Author: User
Php object-oriented php constructor function _ constructz () {} destructor function _ destruct () in php5 () {} // static methods and static attributes can be declared without any parameter static. This is in the memory. Php class static php object-oriented

Php constructor function _ constructz (){

}

The Destructor function _ destruct () {}// in php5 cannot contain any parameters.

Static can declare static methods and static attributes. This is in the memory.

Static methods in php can only access static attributes. non-static methods can only access non-static attributes.

Self? Similar to $ this, but self is used to call static properties. self: property name (not pointing to any instantiated object)

Final? Classes and methods cannot be used to define member attributes. Because final defines constants, defining constants in php is define (); classes defined by final cannot be inherited. Methods marked with final cannot be overwritten.

The define () definition constant uses this function.

Const defines the key word of a constant in a class.

_ ToString ()? If you write this in the class, echo can correctly print the object (that is, the reference class $ pag = new animal () value.

_ Clone? Clone? A function with the same attributes.

_ Call () is an error-absorbing method. if this method is written in the class, an error will be prompted when we call a method that does not exist in the class, but the program continues to run.

_ Autoload () automatic loading? During development, you often need to include and load some files. if you use this method, you don't have to worry about it. when you use this method, it will automatically load

?

?

?

?

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.