Review and Outlook PHP 5.0 changes with PHP 6.0 Outlook _php Tutorial

Source: Internet
Author: User
Currently, most PHP (as the current mainstream development language) installs or uses PHP (as the current mainstream development language) version 4.x. In fact, PHP (as the current mainstream development language) 5.0 has been in place for some time now, and PHP (now the mainstream development language) 5.1.1 has just been released. If you haven't upgraded to these new versions, let's take a look at the changes in the newer version of PHP (which is now the mainstream development language) and finally discuss the features that are expected for PHP (as the current mainstream development language) 6.
One, PHP (as the current mainstream development language) changes in 5.0
As a brand new version number, there are many substantive differences between PHP (as the current mainstream development language) 4 and PHP (as the current mainstream development language) 5. Most of the hype revolves around new object models that have been rewritten. The 5 version of PHP, which is now the mainstream development language, is more complete and performs better. In PHP (now the mainstream development language) 4, the object is actually only a rough data type, and is a value reference. While attempting to maintain as much backward compatibility as possible, in PHP (now the mainstream development language) 5, setting Zend.ze1_compatibility_mode can allow compatibility with the methods in version 4. Of course, PHP (as the current mainstream development language) 5 There are some backward incompatible changes, including:
• The new retained keywords are mostly related to the object model (Exception,final, PHP (as the mainstream development language now) _user_filter,interface,implements,extends,public,private , Protected,abstract,clone,try,catch,
throw). The two words reserved in PHP (the current mainstream development language) 4 no longer exist (cfunction,old_function).
• If an object does not have any properties, it is no longer empty (empty).
• The Array_merge () function now receives only the array.
• Classes can be declared before use (depending on the situation).
Get_class (), Get_parent_class (), and Get_class_methods () can now return a case-sensitive result, and the previous return result is lowercase.
Strrpos () and Strripos () now use the entire string. For example, Var_dump (Strrpos (ABCDEF,DAF)) will return int (3) in PHP (as the current mainstream development language) 4, and bool (false) in PHP (as the current mainstream development language) 5
• If $_server exists, it will be populated with argc and argv-This allows the CLI version to always have access to the data.
• When an invalid IP address is passed, Ip2long () returns false instead of-1.
• A function defined in an include file can now be called at any point in the main file. If the file is included two times (when the function is already defined), PHP (as the current mainstream development language) 5 will also issue a fatal error.
The require_once () and include_once functions now take into account the insensitivity of the windows size, and will include only one file at a time-even if the function is called multiple times with a different case file name.
• Get rid of the original PHP (as now mainstream development language) 4 warning. New PHP (as the current mainstream development language) 5 throws an error when an invalid string offset is encountered.


· The tokenizer extension no longer defines idle T_ml_comment constants.
Note that these seemingly more incompatible changes are not very large, and if you want to port the original code to PHP (as the current mainstream development language) 5, it is possible to make only minimal changes to your script. PHP (as the current mainstream development language) 5 provides a better way to do many things, but if you only want to make the program run, then you will not have too much trouble. Other changes in PHP (as the current mainstream development language) 5 are:

http://www.bkjia.com/PHPjc/509122.html www.bkjia.com true http://www.bkjia.com/PHPjc/509122.html techarticle Currently, most PHP (as the current mainstream development language) installs or uses PHP (as the current mainstream development language) version 4.x. In fact, PHP (as the current 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.