Table of Contents
1. Backward-incompatible changes" >1. Backward-incompatible changes
Home headlines PHP7.2 version performance introduction

PHP7.2 version performance introduction

May 14, 2018 pm 01:49 PM
php introduce

This article mainly introduces the performance of PHP7.2 version to you in detail, hoping to help everyone have a clearer understanding of PHP7.2.

1. Backward-incompatible changes

Core:

  • For closed resources, the gettype() function will return resource (closed), replacing the previous unknown type.

  • For __PHP_Incomplete_Class class object, is_object ()The function will return true.

  • #Remove support for Netware operating system.

  • array type is converted to object type ((object)orsettype() ), the integer key will be converted into an attribute name, which fixes the problem that the numeric key in the previous version cannot be used as an attribute name.

  • Convert object type to array type ((array)or settype() ), and when the properties of an object are mapped to an array (get_object_vars()), the integer properties will be converted into numeric keys, which fixes the previous version The problem of inaccessible integer properties.

  • Unqualified reference to an undefined constant will result in a warning level error, replacing the previous notice level, and subsequent versions will be error level errors. .

  • #The minimum supported Windows versions are Windows 7 and Windows Server 2008 R2.

  • Cancels the compatibility checking behavior of native trait attribute values.

  • object will not be used as a class name.

BcMath

  • ## and fmod()The function is the same, the bcmod() function cancels the modulo operation (%), that is, the decimal part of the value is truncated into an integer. For example: bcmod('4', '3.5') will return 0.5 instead of 1.

Hash

  • ##hash_hmac (), hash_hmac_file(), hash_pbkdf2() and hash_init() (when the options parameter is HASH_HMAC), these functions will no longer support non-encrypted hash functions.

##JSON

  • ##When

    json_decode()When the second parameter assoc of the function is null, the options support option JSON_OBJECT_AS_ARRAY will be enabled, before This parameter has been ignored by us in the version.

    ##Session

#Move In addition to
  • register_globals

    related code, "!" can be used in the key name of $_SESSION.

    session
  • is used to correctly manage the session state and prohibit invalid operations. When there is a problem with the code, it will will trigger the change. If you unfortunately encounter this problem, it means there is a problem with your code.

    ##sesseion_start()
    • ,
    • session_status(), session_regenerate_id(), these functions are used to set or return the correct session state.

    • ##session_unset(), session_write_close()/ session_commit(), session_abort(), session_reset(), these functions return no return value. Returns a Boolean value. They allow empty parameters and have checks for these empty.

    • ##session_start(), session_set_cookie_params(), session_name(), session_module_name(), session_set_save_handler(), session_regenerate_id()session_cache_limiter()session_cache_expire()session_unset(), session_destroy(), session_write_close()/ session_commit(), session_reset(), these functions will disable invalid session status and http header status, and return the correct Boolean value or numerical value.

    • ##session.name, session.save_path, session.cookie_lifetime,session.cookie_path,session.cookie_domain,session.cookie_httponly,session.cookie_secure,session.use_cookies,session.use_only_cookies,session.use_strict_mode,session.referer_check, session.cache_limiter,session.cache_expire,session.lazy_write,session. save_handler,session.serialize_handler,session.gc_probability,session.gc_pior, session.gc_maxlifetime, the setting of these ini values ​​must be successfully called by the ini_set() function , invalid ini modification operations will not succeed.

    • Because the session can be managed correctly (
    • session_start()), some E_ERROR Error messages of level will be converted to level E_WARNING.

    • Sessions will no longer be initialized with invalid and useless sessions
    • ##When the header information has been sent, setting the new ini value will be invalid at this time (via

      session_name(), session_module_name(), session_save_path(), session_cache_limiter() and session_cache_expire() These functions).

      Now these correct behaviors will affect the state of management sessions in cli command line mode. Using output buffering as in web applications will solve the problem with cli scripts.


    Standard

Since version 7.1 , on a 64-bit machine, the order of random numbers generated by

mt_rand()

and rand() with the same seed may be different. Same.

##2. New Features

Core

    When overriding a method or interface, its parameter type can be omitted. This obeys the contravariance of the parameter type of the Liskov equilibrium principle.
  • Allows the inherited abstract class to override the abstract method of the inherited abstract class.

  • # Allows trailing commas to group namespaces.

  • #Annotations for object types are allowed.

##DBA

  • ##Implementation Added support for LMDB backend.

##JSON

  • ##at

    json_encode() and json_decode() Added support for JSON_INVALID_IGNORE and ## Support for #JSON_INVALTD_UTF8_SUBSTITUTE replaces the previous utf-8 encoded invalid type. ##OCI8

##increase Provides support for Transparent Application Failover (TAF) of Oracle Database.

  • PCRE

##increase Internal option (j) modifies the local

PCRE_DUPNAMES
  • option.

    Sodium

##New encryption extension.

  • ##SQLite3

##Implementation to write BLOBs.

  • Standard

##When When compiling PHP with libargon2, the simplified password hashing API has been updated to support Argon2.

windows platform supports the
  • proc_nice()

    function.

  • Zip

  • ##Read /Write encrypted archive, depends on libzip 1.2.0, New method:

ZipArchive:: setEncryptionName($name, $method[,$password]); ZipArchive::setEncryptionIndex($index, $method[ , $ password]); New constants: ZipArchive:: EM_NONE ZipArchive:: EM_AES_128 ZipArchive:: EM_AES_192 ZipArchive:: EM_AES_256

  • ##Accepts "password" from the zip stream context. ZipArchive implements countability and adds the ZipArchive::count()

    method.
  • 3. SAPI module changes
  • 4. Deprecated functionality

The following are the features that will be abandoned in the php8.0 version.

Core

## Track errors in the configuration file will be Abandoned.

##__autoload()

will be deprecated, use
  • spl_autoload_register()

    instead.

  • (unset) will be abandoned. This change will not affect unset ($var) language structure.

  • create_function()The function will be deprecated and replaced by an anonymous function. ##each()

  • Function structure will be deprecated, use
  • foreach()Loop instead.

  • Exif

    ##read_exif_data () will be deprecated, use

    exif_read_data()
instead.

    GD
    • png2wbmp() and jpeg2wbmp() will be deprecated.

    GMP

    • ##gmp_random () will be deprecated, use gmp_random_bits() or () instead.

    Intl

    • #INTL_IDNA_VARIANT_2003 will be deprecated, use INTL_IDNA_VARIANT_UTS46 instead.

    Mbstring

    • ##mbstring The configuration file of .func_overload will be discarded.

    Standard

    • ##No need Parameters to call

      parse_str() will be discarded.

      Calling
    • assert()

      with string parameters will be deprecated and use regular expressions instead.

    • 5. Changed functions

    Standard

    • When set to

      PASSWORD_ARGON2I, password_hash()Argon2 hash can be generated.

    • ##When using PASSWORD_ARGON2I, the following options may be set by default:
    • memory_cost , time_cost. The default value for these options is PASSWORD_ARGON2_DEFAULT_MEMORY_COST. If not set, the defaults are PASSWORD_ARGON2_DEFAULT_TIME_COST and PASSWORD_ARGON2_DEFAULT_THREADS.

    • password_verify()
    • Argon2 hashes can be verified.

      ##password_get_info()
    • and

      password_needs_rehash() can Accepts Argon2 hashes. #mail()/mb_send_mail()

    • Accepts array
    • $extra_header . Array parameters are checked against RFC 2822. Array format: php $extra_headers = [ 'Header-Name' => 'Header value', 'Multiple' => ['One header', 'Another header'], 'Multiline' = " FirstLine\r\n SecondLine", ]; ##When an invalid parameter is passed, count()

      The function will throw warning warning.
    • In big-endian and little-endian byte order, pack()

      and
    • unpack()

      Supports float and double types. number_format()

      The function will ensure that the zero value does not contain a negative sign.
    • ##XML

    #utf8_encode () and

    utf8_decode()
    • functions have been moved to the standard extension as strings.

      6. New functions

    • Core

    Add stream_istty()

    .
    • Addedsapi_windows_vt100_support()

      .
    • ##DOM

    ##DomNodeList

    Implemented Countable and added DomNodeList::count()

    .
    • DOMNamedNodeMapImplements Countable and adds DOMNamedNodeMap::count().

    FTP

    • ##increase ftp_append().

    GD

    • ##increase imagesetclip() and imagegetclip().

    • Addedimageopenpolygon().

    • Addedimageresolution().

    • Added imagecreatefrombmp() and imagebmp( ).

    Hash

    • ##increase hash_hmac_algos().

    Mbstring

    • ##increase

      mb_chr() and mb_ord().

    • Added

      mb_scrub.

      ##OCI8

    ##increase Added
    • oci_register_taf_callback()

      and oci_unregister_taf_callback() support for Transparent Application Failover (TAF) for Oracle databases. Sockets

    ##increase The

      socket_addrinfo_lookup()
    • , socket_addrinfo_connect(), socket_addrinfo_bind() and socket_addrinfo_explain(). SPL

    ##increase

    spl_object_id()
    • .

      7. New classes and interfaces

    8. Move Extensions and SAPI

    Mcypt

    # #The deprecated mcrypt extension has been moved to PECL.

    • libmcrypt has not been maintained since 2007 and continued use of this extension is not recommended.

    • 9. Other changes to the extension

    EXIF

    Added exif tag support for the following formats: Samsung, DJI, Panasonic, Sony, Pentax, Minolta, Sigma/Foveon, AGFA, Kyocera, Ricoh & Epson.

    • ##exif_read_data() and

      exif_t ​​humbnail()
    • Supports passing streams as the first argument.

      ##GD

    ##Move In addition to the

    --enable-gd-native-ttf configuration option.

    • imagegd() Store the truecolor image as a true color image, replacing the previous conversion to color correction plate.

    • mageantialias() is also supported when compiling with system libgd.

    • Mbstring

    • ##mb_check_encoding ()

    Accepts an array parameter and recursively checks its keys and values.

    • ##mb_convert_encoding()

      Accepts an array parameter, the encoding of its value can be converted recursively.

    PDO_OCI

    • ##--with-pdo-oci The configuration syntax of is no longer available for Oracle clients.

    ##pdo_sqlite

    • ##Use sqlite3_prepare_v2() and sqlite3_close_v2() to replace their previous functions.

    10. New global constant

    Core

    • ##PHP_FLOAT_DIG

      ##PHP_FLOAT_EPSILON

    • PHP_FLOAT_MIN

    • PHP_FLOAT_MAX

    • PHP_OS_FAMILY

    • Fileinfo

    ##FILEINFO_EXTENSION
    • GD

    #IMG_EFFECT_MULTIPLY

    • IMG_BMP

    • ##PCRE

    PREG_UNMATCHED_AS_NULL

    • ##Standard:

    ##PASSWORD_ARGON2_DEFAULT_MEMORY_COST

      ##PASSWORD_ARGON2_DEFAULT_TIME_COST
    • PASSWORD_ARGON2_DEFAULT_THREADS

    • ##PASSWORD_ARGON2I

    • 11. Changes in INI file handling

    • sql.safe_mode

    This INI option has been removed.

      realpath_cache_size
    • ##Default It's 4096k.

    ##opcache.fast_shutdown

    • This INI option has been removed. A variant of fast_shutdown handling has been integrated into the PHP kernel and will be enabled by default in production environments.

    12. Windows support

    • Support VT100 console mode.

    13. Other changes

    • Compilation system

    The minimum supported version of autoconf is 2.64.

    Related recommendations:

      How to install IIS, MySQ, nginx, php7.1.7 under Win10?
    • Introduction to new features in PHP7

    • Detailed explanation of the key to doubling the performance of PHP7

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.