Section II--PHP5 object Model--classesandobjectsinphp52_php Tutorial

Source: Internet
Author: User
| = This is haohappy read < > | = Notes in Classes and objects Chapter | = Translation-based + personal experience | = Please do not reprint in order to avoid the unnecessary trouble that may occur, thank you | = Welcome criticism, hope and all the PHP enthusiasts to progress together! +-------------------------------------------------------------------------------+/second section--PHP5 object Model PHP5 has a single-inheritance, Restricts access to the object model that can be overloaded. The "Inheritance", which is discussed in detail later in this chapter, contains parent-child relationships between classes. In addition, PHP supports restrictive access to properties and methods. You can declare members to be private and do not allow external classes to be accessed. Finally, PHP allows a subclass to overload members from its parent class. Haohappy Note: There is no private in PHP4, only public.private is good for better encapsulation. The object model of PHP5 the object as if it were to be passed by reference, unlike any other data type. PHP does not require you to pass and return objects explicitly by reference (reference). In the end of this chapter, the object model based on the handle is elaborated in detail. It is the most important new feature in PHP5. With a more straightforward object model, a handle-based architecture has additional advantages: increased efficiency, low memory footprint, and greater flexibility. In the first few versions of PHP, the script replicates the object by default. Now PHP5 only moves the handle, requiring less time. The increase in script execution efficiency is due to the avoidance of unnecessary replication. While the object system brings complexity, it also brings the benefit of execution efficiency. At the same time, reducing replication means taking up less memory and allowing more memory for other operations, which also increases efficiency. Haohappy Note: Based on a handle, it means that two objects can point to the same piece of memory, reducing both the copy action and the memory footprint. The Zand Engine 2 offers greater flexibility. A pleasing development is the permission to refactor-a class method is executed before the object is destroyed. This is also good for using memory, allowing PHP to clearly know when there is no reference to the object and allocating the vacated memory to other uses.

http://www.bkjia.com/PHPjc/532166.html www.bkjia.com true http://www.bkjia.com/PHPjc/532166.html techarticle | = Note for Haohappy read > | = Classes and objects in the Chapter | = translation + personal Experience | = To avoid unnecessary inconvenience that may occur please do not reprint, thank you | = Welcome to criticize ...

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