PHP version php5.2.x to 5.3.x

Source: Internet
Author: User

Non-compatible changes

1. A new internal parameter parsing API is applied in all binding extensions of 5.3, and Null is returned when an incompatible parameter is passed to the function, with some exceptions, such as the function Get_class () returning false when an error occurs

2, Clearstatcache () The default is no longer clear cache realpath.

3, array functions Natsort (), Natcasesort (), Usort (), Uksort (), Array_flip (), and Array_unique () will no longer accept objects as arguments.

4. A function that passes a parameter by reference has a change in behavior when it is passed the call by value. The previous function will accept arguments passed by value, and will now throw a fatal error; Before any expected delivery of the application but passed a solid or literal value on the call, you need to assign it to a variable before the call.

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

6. The new MYSQLND library will no longer read the MySQL configuration file (My.cnf/my.ini), which is different from the old version of the Libmysql library. If your code relies on these configuration files, you can use Mysqli_options () to load it explicitly. Note that this means that if MySQL in PDO supports compiling with MYSQLND, the PDO-specific constants pdo::mysql_attr_read_default_file and Pdo::mysql_attr_read_default_grou P will be undefined.

7, __tostring () Magic method no longer accepts parameters.

8, Magic method __get,__set,__isset,__unset,__call should always be public and cannot be static, method signature is required.

9, now __call Magic method in accessing the private and protected method is called, static method with __callstatic.

10. The Func_get_arg (), Func_get_args (), and Func_num_args () functions cannot be used within a file when include or require a file within a function.

11. Reserved Keywords: goto, namespace

New features

1. Support for adding namespaces

2. Add static late binding (late static binding) support

Late static binding:

Principle: Stores the class name in the previous "non-forwarded call". When a static method call is made, the class name is the one explicitly specified (: The class to the left of the operator), and the class to which the object belongs when a non-static method call is made.

Late binding means thatstatic:: It is no longer parsed to define the class in which the current method resides, but is calculated at the actual run time.

The so-called "forward call" refers to static calls made in the following ways, self::, Parent::, Static::, and Forward_static_call ().

You can use the Get_called_class () function to get the class name of the method being called.

http://php.net/manual/zh/language.oop5.late-static-bindings.php

3. Add a goto jump tag with restrictions support

4. Added native closure support, anonymous functions, usually used as callback functions.

5, added two magic methods, __callstatic and __invoke

__callstatic: Used when invoking a non-accessible method in a static manner.

__invoke the method is called automatically when an attempt is made to invoke an object in a way that invokes a function.

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

7. Use Heredoc to initialize static variables and class properties, constants.

8. You can declare constants outside of the class using the Const keyword.

9, the ternary operator has a shorthand form $b = $a ==1? : 0;

10. The HTTP streaming wrapper will treat all status codes from 200 to 399 as successful.

11. Dynamic Access static method

12. Exceptions can be embedded

13. New garbage collector with circular reference and open by default

14, Mail () support email send log.

SAPI changes to the module

@TODO

PHP 5.3 deprecated features

1, PHP5.3 added two error levels:

E_DEPRECATEDIndicates that a function or function has been deprecated

E_USER_DEPRECATED Indicates deprecated functionality in user code

2. Deprecated functions

3. Deprecated functions

Discard the return value of new by reference (with ambiguous translation Oh!! )

Truth: You cannot directly reference the return value of new $a = &new Redis ();

Pass-through references are deprecated when invoked

PHP 5.3 reserved Features

1, the Is_a () function is reserved.

New parameters

1. PHP Core

Round () new mode parameter

Strstr () and Stristr () new Before_needle parameter, if TRUE,STRSTR () will return the portion of needle before the position in haystack

Exception::__construct ()-Adds a previous parameter that indicates the previous exception in the exception chain.

...................................

@TODO

2. JSON

Json_encode () New options parameter encoding format

Json_decode () added depth parameter User specified recursion depth.

3, Stream (Streams)

@TODO

New function

1. PHP Core

2, Date/time

Date_add () Adds a certain number of days, months, years, hours, minutes, seconds to a DateTime object

Date_create_from_format () returns a DateTime object based on the given format.

Date_diff () returns the differences of two DateTime objects

Date_get_last_errors () returns the last Date/time a false warning or error occurred

Date_parse_from_format () Get information about a date

Date_sub () Subtracts a certain amount of time from a DateTime object

Timezone_version_get () returns the database information for the current time zone

3, Hash

Hash_copy () Copy hash environment copy context resource

4. IMAP

@TODO

5. JSON

Json_last_error () returns the last JSON error

6. MySQL Improvements

................................

@TODO

New class constants

1. PDO:: Fb_attr_date_format Format the date

Pdo::fb_attr_time_format-Formats the time.

Pdo::fb_attr_timestamp_format-Formats the timestamp.

PHP version php5.2.x to 5.3.x

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.