PHP5.3 new Features summary, php5.3 new features _php tutorial

Source: Internet
Author: User

PHP5.3 new Features summary, php5.3 new features


This paper summarizes and analyzes the new characteristics of PHP5.3. Share to everyone for your reference, as follows:

1. namespace resolves the problem of class, function and constant name conflicts

2. When a static binding inherits, the parent class can call the subclass directly to override the parent class's method

Class A {public  static function who () {    echo __class__;  }  public static function test () {    static::who ();//Late static binding starts here  }}class B extends A {public  static function () {    echo __class__;  }} B::test ();

3, anonymous function, also called the closure function (closures), allows temporary creation of a function without a specified name. Most often used as a callback function

The anonymous function does the callback function Uasort ($arr, function ($a, $b) {})

The closure function can also be used as the value of a variable

$FN = function ($a) {  echo $a;}; $FN (1);

PHP automatically converts an expression into an object instance of the built-in class closure

$FN = function ($a) {  echo $a;}; EE ($FN);/** * Closure Object (  [parameter] = Array    (      [$a] =     )) */

Anonymous functions are now implemented through the closure class. is not yet stable and does not apply to formal development

3,?: operator

$a = 0; $b = 2;ee ($a?: $b); # 2 similar to JS | |

4, new constant __dir_

5, new garbage collection mechanism, solve the problem of circular reference

Gc_enable (); Activates the Loop reference collector, which turns on Var_dump (Gc_collect_cycles ()) by default; Forced reclamation of an invalid variable gc_disable (); Disable GC

Read more about PHP related content readers can view the topic: "PHP Basic Grammar Introductory Tutorial", "PHP error and Exception handling method summary" and "PHP common functions and Skills summary"

I hope this article is helpful to you in PHP programming.

Articles you may be interested in:

    • Ubuntu12 Build and install PHP5.3 development environment
    • php5.3 Unable to connect MSSQL database solution
    • php5.3 later versions connect the sqlserver2000 method
    • PHP5.3 and 5.5 obsolete and outdated functions summary
    • Using Pthreads to implement real PHP multithreading (requires PHP5.3 or later)
    • php5.3 Goto Function Introduction and Example
    • php5.3 does not support Session_register () workaround that this function has enabled
    • php5.3 Notice Notes
    • Summary of php5.3 waste function
    • PHP5.3.1 no longer supports ISAPI

http://www.bkjia.com/PHPjc/1099064.html www.bkjia.com true http://www.bkjia.com/PHPjc/1099064.html techarticle PHP5.3 new Features summary, php5.3 new features This paper summarizes and analyzes the new characteristics of PHP5.3. Share to everyone for your reference, as follows: 1, Namespace resolved class, function and constant name conflict ...

  • 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.