PHP 5 was launched yesterday -- new features of PHP 5/Zend Engine 2.0

Source: Internet
Author: User
Tags php website zend
Preface
Today, I suddenly thought of a revolution on the official PHP website and saw the announcement of PHP5 at a glance. Although I have seen the predictions of PHP5 before, I have carefully read the new features of PHP 5/Zend Engine 2.0, and a JAVA atmosphere is coming...
This article was first translated on the CSDN website to attract readers.
New features of PHP 5/Zend Engine 2.0
Xu call Chun translation sfwebsite@hotmail.com
Http://www.php.net/zend-engine-2.php
Brand new Object Model
The object processing part in PHP has been completely rewritten, providing better performance and more functions. In earlier versions of PHP, objects and built-in variable types (such as integer and string) are processed in the same way. The drawback is that when a variable is assigned as an object or an object is passed as a parameter, the result is an object copy. In the new version, an object is referenced by a handle, rather than its value. (The handle can be recognized as the object identifier)
Many PHP programmers may not be aware of the "replication quirks" of the previous object model, so the previous PHP program will run without any changes or just a small change.
Private and protected members
PHP 5 introduces private and protected member variables that can define when class attributes can be accessed.
Example
Class protection member variables can be accessed in the extension class of this class, while private member variables can only be accessed in this class.
<? Php
Class MyClass {
Private $ Hello = "Hello, World! ";
Protected $ Bar = "Hello, Foo! ";
Protected $ Foo = "Hello, Bar! ";
Function printHello (){
Print "MyClass: printHello ()". $ this-> Hello;
Print "MyClass: printHello ()". $ this-> Bar;
Print "MyClass: printHello ()". $ this-> Foo;
    }
}
Class MyClass2 extends MyClass {
Protected $ Foo;
       
Function printHello (){
MyClass: printHello ();/* shocould print */
Related Article

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.