Comparison of Different Php versions

Source: Internet
Author: User
PHP5.5.X backward compatible changes: 1. Support for Windows XP and 2003 has been abandoned. To build a PHP version for Windows, you need Windows Vista or an updated system. 2. Some changes have been made to make pack () and unpack () more compatible with Perl. To maintain better compatibility, use the version_compare function.

PHP5.5.X incompatible changes: 1. Support for Windows XP and 2003 has been abandoned. To build a Windows version of PHP, you need Windows Vista or an updated system. 2. Some changes have been made to make pack () and unpack () more compatible with Perl. To maintain better compatibility, use the version_compare function.

PHP5.5.X

Incompatible changes:

1. Support for Windows XP and 2003 has been abandoned. To build a Windows version of PHP, you need Windows Vista or an updated system.

2. Some changes have been made to make pack () and unpack () more compatible with Perl. You can use these two functions to maintain better compatibility.version_compareFunction to compare the php version.

3. Remove the php logo guids (including php_logo_guid (),Php_egg_logo_guid (),Php_real_logo_guid (), Zend_logo_guid () function ).

New features:

1. New generators are added. generators provides an easier method to implement simple object iteration.IteratorThe performance overhead and complexity of the interface class.

2. AddFinallyKeywords

3. foreach supports list (). The foreach control structure now supports the list () structure to separate nested arrays from individual variables.

4. empty () supports arbitrary expressions, not just variables.

5. arrays and strings can now be directly unreferenced to access each element and character (for example:echo [1, 2, 3][0];echo 'PHP'[0];).

6. New password hash API.

7. improved GD (FLIP supports the use of the new imageflip () function, advanced cropping supports the use of imagecrop () & imagecropauto () function, and WebP supports the use of imagecreatefromwebp () & imagewebp ()).


PHP5.4.X

Incompatible changes:

1. Security mode is no longer supported.

2. Remove magic quotes. get_magic_quotes_gpc () and get_magic_quotes_runtime () are always returned.FALSE. Call set_magic_quotes_runtime () to generateE_CORE_ERRORLevel error.

3. register_globals and register_long_arraysPhp. iniCommand is removed.

4. The reference transfer during the call is removed.

5. The break and continue statements no longer accept variable parameters (for example:Break 1 + foo () * $ bar;). SimilarBreak 2;Such fixed parameters can still be used. This change is not allowedBreak 0;AndContinue 0;.

6. In the date and time extension, the time zone cannot be set using the TZ (TimeZone) environment variable. Date. timezone is requiredPhp. iniConfigure the option or the date_default_timezone_set () function to specify the time zone. PHP will not try to guess the time zone, but roll back to "UTC" and issueE_WARNINGError.

7. Non-numeric string offset, such$ A ['foo']$ A is a string. If isset () is used, false is returned. If empty () is used, true is returned.E_WARNINGError.

8. converting an array into a string will generateE_NOTICELevel error, but the returned result is still a string"Array".

9.NULL,FALSE, Or when an empty string is added as an object's property,E_WARNINGLevel errors, ratherE_STRICT.

10. Currently, using global variables in the parameter name may cause a fatal error. Disable similarFunction foo ($ _ GET, $ _ POST ){}Such code.

11. The Salsa10 and Salsa20 hashing algorithms are removed.

12. When two empty arrays are used as parameters, array_combine () returnsArray ()InsteadFALSE.

13. htmlentities () will process the Asian character set like htmlspecialchars (). This is a previous PHP version, but now it will issueE_STRICTError.

14. We strongly recommend that you do not use eregi () any more. This feature is removed from the latest version.

15. The following keywords are currently retained and cannot be used by function names or class names (trait, callable, insteadof ).

16. the following functions have been removed from PHP (define_syslog_variables (), import_request_variables (), counts (), session_register (), session_unregister (), counts (), mysqli_bind_result (), counts (), mysqli_fetch (), mysqli_param_count (), mysqli_get_metadata (), commit (), mysqli: client_encoding (), mysqli_stmt: stmt ()).

New features:

1. Added support for traits.

2. Added short array syntax, such$ A = [1, 2, 3, 4];Or$ A = ['one' => 1, 'two' => 2, 'three '=> 3, 'four' => 4];.

3. Added support for accessing and parsing function returned array members, suchFoo () [0].

4. Now closures support$ This.

5. Whether or not short_open_tag is setPhp. iniOption, Always available.

6. Newly Added members of the sequence class during instantiation, for example:(New Foo)-> bar ().

7. Supported nowClass: {expr }()Syntax.

8. added the binary direct quantity, for example:0b001001101.

9. Improve resolution error messages and incompatible parameter warnings.

10. The SESSION extension can now track the File Upload progress.

11. built-in CLI mode web server for development.


PHP5.3.X

Incompatible changes:

1. A new internal Parameter Parsing API is applied to all binding extensions of PHP 5.3.x. If incompatible parameters are passed to the function, NULL is returned. but there are some exceptions. For example, if the get_class () function returns an errorFALSE.

2. clearstatcache () does not clear the cache realpath by default.

3. realpath () is completely platform independent. The result is an invalid relative path, for example_ FILE _. "/../x"Will not work.

4. call_user_func () series functions use $ this even if the caller is a parent class.

5. the array functions natsort (), natcasesort (), usort (), uasort (), uksort (), array_flip (), and array_unique () no longer accept objects as parameters. when applying these functions to an object, first convert the object to an array.

6. the behavior of a function that transmits parameters by reference changes when it is called by value. previously, the function will accept parameters passed by value, and a fatal error will be thrown. any function that is expected to pass a reference but has passed a constant or literal value during the call needs to assign the value to a variable before calling the function.

7. The new mysqlnd library uses the new 41-byte password format of MySQL 4.1. Continuing to use the old 16-byte password will cause mysql_connect () and other similar functions to throw"Mysqlnd cannot connect to MySQL 4.1 + using old authentication ."Error.

8. the new mysqlnd library will no longer read the MySQL configuration file (my. cnf/my. ini), which is different from the libmysql library of the old version. if your code depends on these configuration files, you can use mysqli_options () to explicitly load it. note: this means that if MySQL in PDO supports mysqlnd compilation, the PDO-specific constantPDO::MYSQL_ATTR_READ_DEFAULT_FILEAndPDO::MYSQL_ATTR_READ_DEFAULT_GROUPIt will be undefined.

9. SplFileInfo and Its Related directory classes will remove /.

10. _ toString the parameter is no longer accepted by the magic method.

11. magic method _ get, _ set, _ isset, _ unset, and _ call should always be public and cannot be static ). method signature is required.

12. Now the _ call magic method is called when accessing the private and protected (protected) methods.

13. When a file is included or require in the function, func_get_arg (), func_get_args (), and func_num_args () functions cannot be used in the file.

14. added a simulation layer wrapped outside the MHASH extension. However, not all algorithms are involved. It is worth noting that the s2k hashing algorithm. This means that the s2k hash algorithm is no longer available in PHP 5.3.0.

New features:

1. Added namespace support.

2. Added support for static late binding.

3. Added support.

4. Added native closures (Lambda/anonymous functions) support.

5. Two magic methods are added, __callstatic and _ invoke.

6. Added Nowdoc syntax support, similar to Heredoc syntax, but contains single quotes.

7. Heredoc can be declared using double quotation marks to supplement the Nowdoc syntax.

8. It can be used outside the class.ConstKeyword declaration constant.

9. The ternary operators are abbreviated as follows:? :.

10. The HTTP stream package regards all status codes from 200 to 399 as successful.

11. Dynamic Access to static methods becomes possible.

12. Exceptions can be embedded.

13. added a garbage collector for loop reference and enabled by default.

14. mail () now supports sending logs by email. (Note: Only emails sent through this function are supported .)



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.