Home>Article>Backend Development> PHP7 deprecated features

PHP7 deprecated features

大家讲道理
大家讲道理 Original
2017-01-23 11:28:59 1270browse
The following features have been discontinued and may be removed in future versions of PHP.

PHP4-style constructors

PHP4-style constructors, which have the same name as the class because they are methods of the class in which they are defined, are now deprecated, and will be removed in the future. If PHP4's constructor is just a constructor defined in a class, PHP7 will issue E_DEPRECATED. Class implementation constructor __construct() method is not affected.

Example

This will produce the following output in the browser -

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in...

Static call to non-static method

Non-static method Static calls are deprecated and may be removed in the future.

Example

This will produce the following output in the browser -

Deprecated: Non-static method A::b() should not be called statically in... Non-static call

password_hash() - salt option

The salt option of the password_hash() function has been Deprecated so developers don't generate their own (usually unsafe) salts. The function itself generates a cryptographically secure salt when the developer does not provide a salt value - therefore, custom salt generation is no longer needed.

capture_session_meta SSL context option

capture_session_meta SSL context option has been deprecated. SSL metadata is now obtained through the stream_get_meta_data() function.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn