New featuresConstant scalar expressionsIt is now possible to provide a scalar expression involving numeric and string literals and/or constants in contexts where PHP previously expected a static value, such as constant and property declarations and default function arguments.
<?php The above example will output: 4 The value of THREE is 3 Variadic functions via ...Variadic functions can now be implemented using the ... operator, instead of relying on func_get_args.
<?php The above example will 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 Argument unpacking via ...Arrays and Traversable objects can be unpacked into argument lists when calling functions by using the ... operator. This is also known as the splat operator in other languages, including Ruby.
<?php The above example will output: 6 use function and use constThe use operator has been extended to support importing functions and constants in addition to classes. This is achieved via the use function and use const constructs, respectively.
<?php The above example will output: 42 Name\Space\f phpdbgPHP now includes an interactive debugger called phpdbg implemented as a SAPI module. For more information, please visit the » phpdbg documentation. php://input is reusablephp://input may now be reopened and read as many times as required. This work has also resulted in a major reduction in the amount of memory required to deal with POST data. Large file uploadsFiles larger than 2 gigabytes in size are now accepted. GMP supports operator overloadingGMP objects now support operator overloading and casting to scalar types. This allows for more expressive code using GMP:
<?php gost-crypto hash algorithmThe gost-crypto hash algorithm has been added. This implements the GOST hash function using the CryptoPro S-box tables as specified by » RFC 4357, section 11.2. SSL/TLS improvementsThe OpenSSL extension has been extended to include support for extracting and verifying certificate fingerprints. openssl_x509_fingerprint has been added to extract a fingerprint from an X.509 certificate, and two SSL stream context options have been added: capture_peer_cert to capture the peer's X.509 certificate, and peer_fingerprint to assert that the peer's certificate should match the given fingerprint.
Additionally, a specific crypto method such as SSLv3 or TLS may now be
selected by setting the crypto_method
SSL stream context option. Possible
options include |