PHP 各版本特性

来源:互联网 发布:万网域名注册网站 编辑:程序博客网 时间:2024/06/04 18:02

链接

PHP5.3

PHP5.4

PHP5.5

PHP5.6

PHP7.0

PHP7.1

PHP7.2

PHP 5.3.0 offers a wide range of new features:

  • Support for namespaces has been added.
  • Support for Late Static Bindings has been added.
  • Support for jump labels (limited goto) has been added.
  • Support for native Closures (Lambda/Anonymous functions) has been added.
  • There are two new magic methods, __callStatic() and __invoke().
    Nowdoc syntax is now supported, similar to Heredoc syntax, but with single quotes.
  • It is now possible to use Heredocs to initialize static variables and class properties/constants.
  • Heredocs may now be declared using double quotes, complementing the Nowdoc syntax.
  • Constants can now be declared outside a class using the const keyword.
  • The ternary operator now has a shorthand form: ?:.
  • The HTTP stream wrapper now considers all status codes from 200 to 399 to be successful.
  • Dynamic access to static methods is now possible:

PHP 5.4.0 offers a wide range of new features:

  • Support for traits has been added.
  • Short array syntax has been added, e.g. a=[1,2,3,4];ora = [‘one’ => 1, ‘two’ => 2, ‘three’ => 3, ‘four’ => 4];.
  • Function array dereferencing has been added, e.g. foo()[0].
  • Closures now support $this.

PHP 5.5.0 offers a wide range of new features:

  • Generators added
  • finally keyword added
  • New password hashing API
  • foreach now supports list()
  • empty() supports arbitrary expressions
  • array and string literal dereferencing
  • Class name resolution via ::class
  • OPcache extension added
  • foreach now supports non-scalar keys
  • Apache 2.4 handler supported on Windows
  • Improvements to GD

PHP 5.6.0 offers a wide range of new features:

  • Constant expressions
  • Variadic functions via …
  • Argument unpacking via …
  • Exponentiation via **
  • use function and use const
  • phpdbg
  • Default character encoding
  • Large file uploads
  • GMP supports operator overloading
  • hash_equals() for timing attack safe string comparison
  • __debugInfo()
  • gost-crypto hash algorithm
  • SSL/TLS improvements
  • pgsql async support

PHP 7.0.0 offers a wide range of new features:

  • Scalar type declarations
  • Return type declarations
  • Null coalescing operator
  • Spaceship operator
  • Constant arrays using define()
  • Anonymous classes
  • Unicode codepoint escape syntax
  • Closure::call()
  • Filtered unserialize()
  • IntlChar
  • Expectations
  • Group use declarations
  • Generator delegation
  • Integer division with intdiv()
  • Session options
  • preg_replace_callback_array()
  • CSPRNG Functions
  • list() can always unpack objects implementing ArrayAccess
  • Class member access on cloning has been added, e.g. (clone $foo)->bar().

PHP 7.1.0 offers a wide range of new features:

  • Nullable types
  • Void functions
  • Symmetric array destructuring
  • Class constant visibility
  • iterable pseudo-type
  • Multi catch exception handling
  • Support for keys in list()
  • Support for negative string offsets
  • Support for AEAD in ext/openssl
  • Convert callables to Closures with Closure::fromCallable()
  • Asynchronous signal handling
  • HTTP/2 server push support in ext/curl

    PHP 7.2.0 offers a wide range of new features:

  • New object type
  • Extension loading by name
  • Abstract method overriding
  • Sodium is now a core extension
  • Password hashing with Argon2
  • Extended string types for PDO
  • Additional emulated prepares debugging information for PDO
  • Support for extended operations in LDAP
  • Address Information additions to the Sockets extension
  • Parameter type widening
  • Allow a trailing comma for grouped namespaces
  • proc_nice() support on Windows
  • pack() and unpack() endian support
  • Enhancements to the EXIF extension
  • New features in PCRE
  • SQLite3 allows writing BLOBs
  • Oracle OCI8 Transparent Application Failover Callbacks
  • Enhancements to the ZIP extension