PHP 7 deprecate...LOGIN

PHP 7 deprecated features


PHP4 style constructor

In PHP4, the function in the class can have the same name as the class name. This feature was abandoned in PHP7, and an E_DEPRECATED error will be issued. When the method name is the same as the class name, the class is not in the namespace, and the PHP5 constructor (__construct) does not exist, an E_DEPRECATED error will be generated.

Example

<?php
class A {
   function A() {
      print('Style Constructor');
   }
}
?>
The above program execution output result 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...

Call non-static method in static way

Call in static way Non-static method, no longer supported:

Instance

<?php
class A {
   function b() {
      print('Non-static call');
   }
}
A::b();
?>

The above program execution output result is:

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

password_hash() random factor Options

The original salt quantity of the function no longer needs to be provided by the developer. The function has salt capability by default, and developers do not need to provide a salt value.


capture_session_meta SSL context option

The "capture_session_meta" SSL context option is deprecated. Encryption-related metadata active on the stream resource can be accessed through the return value of stream_get_meta_data().

Next Section
<?php class A { function A() { print('Style Constructor'); } } ?>
submitReset Code
ChapterCourseware