New Features of php5.6

Source: Internet
Author: User
Tags certificate fingerprint gmp
PHP5.6 has released Alpha, indicating that the next major version is coming soon. What new features does PHP5.6 bring? This article will introduce these features and discuss the benefits they can bring to developers. Constant Scalar expressions (Constantscalarexpressions) in constants, attribute declarations, and function parameter default value declarations, earlier versions only allow constant

PHP5.6 has released Alpha, indicating that the next major version is coming soon. What new features does PHP5.6 bring? This article will introduce these features and discuss the benefits they can bring to developers. When Constant scalar expressions (Constant scalar expressions) are declared as constants, attribute declarations, and function parameter default values

PHP5.6 has released Alpha, indicating that the next major version is coming soon. What new features does PHP5.6 bring? This article will introduce these features and discuss the benefits they can bring to developers.

Constant scalar expression (Constant scalar expressions)

When constants, attribute declarations, and function parameter default values are declared, only constant values are allowed in previous versions. In PHP5.6, scalar expressions containing numbers, string literal values, and constants are allowed.

The above code output:

4 The value of THREE is 3 
Variable Parameter functions (Variadic functions ...)

Variable Parameter functions are no longer dependent on the func_get_args () function. Now you can use the new operators....More concise implementation.


  

The above code output:

$req: 1; $opt: 0; number of params: 0$req: 1; $opt: 2; number of params: 0$req: 1; $opt: 2; number of params: 1$req: 1; $opt: 2; number of params: 2$req: 1; $opt: 2; number of params: 3
Parameter unpacking function (Argument unpacking ...)

When calling a function...Operators can unpack arrays or traversal objects to the parameter list, which is similar to the extension (splat) Operator in Ruby and other languages.


   

The above code output:

6
Use function and use const)

useThe operator starts to support the import of functions and constants.use functionAnduse constStructure usage example:

 
    

The above code output:

42Name\Space\f
Phpdbg

PHP comes with an interactive debugger phpdbg, which is an SAPI module. For more information, see phpdbg.

Php: // input can be reused

php://inputSupports multiple open and read operations, which greatly improves the memory usage of the POST data processing module.

Large file upload support

You can upload large files larger than 2 GB.

GMP supports Operator Overloading

GMP objects support Operator Overloading and conversion to scalar, improving code readability, such:

 
     

Added the gost-crypto hash algorithm.

Implemented Using CryptoPro S-box tablesgost-cryptoFor details about the hash algorithm, see RFC 4357 and section 11.2.

SSL/TLS Improvement

OpenSSL extension adds the certificate fingerprint extraction and verification functions,openssl_x509_fingerprint()Used to extract the fingerprint of the X.509 Certificate. The SSL stream context option is as follows:capture_peer_certUsed to obtain the peer X.509 Certificate;peer_fingerprintUsed to assert that the Peer certificate matches the given fingerprint.

In addition, you can use the SSL stream context Optioncrypto_methodSpecify the encryption method, such as SSLv3 or TLS. Currently, the supported options include STREAM_CRYPTO_METHOD_SSLv2_CLIENT, cipher, STREAM_CRYPTO_METHOD_SSLv23_CLIENT (default), or STREAM_CRYPTO_METHOD_TLS_CLIENT.

Turn: http://wulijun.github.io/2014/01/25/whats-new-in-php-5-6.html

Original article address: New Features of php 5.6, thanks to the original author for sharing.

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.