Review and Outlook on PHP5.0 changes and PHP6.0 outlook _ PHP Tutorial

Source: Internet
Author: User
Let's review and look forward to PHP5.0's changes and PHP6.0's outlook. Currently, most php (as the mainstream development language) is installed with php (as the mainstream development language) version 4.x. In fact, php (as the current mainstream development language) currently, most php (as the current mainstream development language) installation or use php (as the current mainstream development language) version 4. x. In fact, php (as the mainstream development language) 5.0 has been released for some time, and php (as the mainstream development language) 5.1.1 has just been released. If you have not upgraded to these new versions, let's take a look at the changes in the new version of php (as the mainstream development language, finally, we will discuss the expected features of php (as the mainstream development language) 6.
I. Changes in php (as the mainstream development language) 5.0
As a brand new version, there are many substantial differences between php (as the mainstream development language) 4 and php (as the mainstream development language) 5. Most of the hype focuses on the new object model that has been rewritten. Php (as the mainstream development language) version 5 is more complete and has better running performance. In php (as the mainstream development language) 4, the object is actually only a rough data type and a value reference. While trying to maintain as many backward compatibility as possible, zend. zemo-compatibility_mode can be set in php (as the current mainstream development language) 5 to allow compatibility with methods in version 4. Of course, php (as the mainstream development language) 5 also has some backward incompatible changes, including:
· Most of the new reserved keywords are related to the object model (exception, final, php (as the mainstream development language) _ user_filter, interface, implements, extends, public, private, protected, abstract, clone, try, catch,
Throw ). The two words reserved in php (as the mainstream development language) 4 no longer exist (cfunction, old_function ).
· If an object does not have any attributes, it is no longer empty (empty ).
· Currently, the array_merge () function only receives arrays.
· Classes can be declared before use (depending on the specific situation ).
· Get _ class (), get_parent_class () and get_class_methods () can now return a case-sensitive result, whereas the previous results are all in lowercase.
· Strrpos () and strripos () now use the entire string. For example, var_dump (strrpos (ABCDEF, DAF) Returns int (3) in php (as the mainstream development language) 4 ), in php (as the mainstream development language) 5, return bool (false)
· If $ _ SERVER exists, it will be populated with argc and argv-this allows the CLI version to always access the data.
· When an invalid IP address is passed, ip2long () returns FALSE instead of-1.
· Functions defined in an include file can now be called as the main file at any time. If the file is included twice (then the function has been defined), php (as the mainstream development language) 5 will also issue a fatal error.
· The require _ once () and include_once functions take into account the unsensitivity of Windows size and include only one file at a time-even if the function is called multiple times with different case names.
· Get rid of the warning in php (as the mainstream development language) 4. New php (as the mainstream development language) 5 will throw an error when encountering an invalid string offset.


· The Tokenizer extension no longer defines idle T_ML_COMMENT constants.
Note that these seemingly many incompatible changes are not great, and if you want to port the original code to php (as the mainstream development language) 5, you may only make a few modifications to your script. Php (as the mainstream development language) 5 provides a better way to do many things, but if you only want to make the program run, you will not encounter too much trouble. Other changes in php (as the mainstream development language) 5 include:

Install idea (as the mainstream development language) or use php (as the mainstream development language) version 4.x. In fact, php (as the mainstream development language )...

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.