PHP 7 Deprecated Features
PHP 4 style constructors
In PHP 4, a function in a class could have the same name as the class; this feature is deprecated in PHP 7 and will emit an E_DEPRECATED error. When the method name is the same as the class name, the class is not in a namespace, and the PHP 5 constructor (__construct) does not exist, an E_DEPRECATED error is produced.
Example
Example
The output of the above program is:
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...
Calling non-static methods statically
Calling non-static methods statically is no longer supported:
Example
Example
The output of the above program is:
Deprecated: Non-static method A::b() should not be called statically in...
Non-static call
password_hash() salt option
The salt amount is no longer required to be provided by the developer. The function has built-in salt capability internally, so the developer does not need to provide a salt value.
capture_session_meta SSL context option
The "capture_session_meta" SSL context option is deprecated. The active encryption-related metadata on the stream resource can be accessed through the return value of stream_get_meta_data().
PHP 7 New Features