Home > Backend Development > PHP7 > body text

php7.0.x deprecated features

L
Release: 2023-02-17 15:24:01
forward
2928 people have browsed it

php7.0.x deprecated features

Deprecated feature in php 7.0.x

PHP4-style constructors

PHP4-style constructors (method names are the same as class names) are deprecated and will be removed in the future. PHP7 will generate an E_DEPRECATED warning if only PHP4-style constructors are used in a class. If the __construct() method is also defined, it will not be affected.

<?php
class foo {
    function foo() {
        echo &#39;I am the constructor&#39;;
    }
}
?>
Copy after login

The above routine will output:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in example .php on line 3

Static call to non-static method

Abandoned Static call is not declared into a static method, this feature may be completely removed in the future.

<?php
class foo {
    function bar() {
        echo &#39;I am not static!&#39;;
    }
}
foo::bar();
?>
Copy after login

The above routine will output:

Deprecated: Non-static method foo::bar() should not be called statically in - on line 8<br>I am not static!

password_hash() salt option

The salt option in the password_hash() function is obsolete. Prevent developers from generating their own salts (generally less secure). When the developer does not pass this value, the function itself will generate a cryptographically secure salt value. Therefore there is no need to pass in your own custom salt value.

capture_session_meta SSL context option

The SSL context option in capture_session_meta is obsolete. SSL metadata can now be obtained via stream_get_meta_data().

Deprecated in LDAP

The following functions have been deprecated:

ldap_sort()

Recommended Tutorial: "PHP7" "PHP Tutorial"

The above is the detailed content of php7.0.x deprecated features. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!