Home> headlines> body text

PHP7.2 version performance introduction

小云云
Release: 2018-05-14 13:49:58
Original
11828 people have browsed it

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, thegettype()function will returnresource (closed), replacing the previousunknown type.

  • For__PHP_Incomplete_Classclass 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)orsettype()), 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 nativetraitattribute values.

  • objectwill not be used as a class name.

BcMath

  • ## andfmod()The function is the same, thebcmod()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()andhash_init()(when the options parameter isHASH_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 optionJSON_OBJECT_AS_ARRAYwill 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 theini_set()function , invalid ini modification operations will not succeed.

    • Because the session can be managed correctly (
    • session_start()), someE_ERROR Error messages of levelwill be converted to levelE_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()andsession_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()

andrand()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()andjson_decode()Added support forJSON_INVALID_IGNOREand ## Support for#JSON_INVALTD_UTF8_SUBSTITUTEreplaces 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 theZipArchive::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 affectunset ($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()andjpeg2wbmp()will be deprecated.

    GMP

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

    Intl

    • #INTL_IDNA_VARIANT_2003will be deprecated, useINTL_IDNA_VARIANT_UTS46instead.

    Mbstring

    • ##mbstring The configuration file of .func_overloadwill 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 isPASSWORD_ARGON2_DEFAULT_MEMORY_COST. If not set, the defaults arePASSWORD_ARGON2_DEFAULT_TIME_COSTandPASSWORD_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

    Addstream_istty()

    .
    • Addedsapi_windows_vt100_support()

      .
    • ##DOM

    ##DomNodeList

    Implemented Countable and addedDomNodeList::count()

    .
    • DOMNamedNodeMapImplements Countable and addsDOMNamedNodeMap::count().

    FTP

    • ##increaseftp_append().

    GD

    • ##increaseimagesetclip()andimagegetclip().

    • Addedimageopenpolygon().

    • Addedimageresolution().

    • Addedimagecreatefrombmp()andimagebmp( ).

    Hash

    • ##increasehash_hmac_algos().

    Mbstring

    • ##increase

      mb_chr()andmb_ord().

    • Added

      mb_scrub.

      ##OCI8

    ##increase Added
    • oci_register_taf_callback()

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

    ##increase The

      socket_addrinfo_lookup()
    • ,socket_addrinfo_connect(),socket_addrinfo_bind()andsocket_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-ttfconfiguration 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 ofis no longer available for Oracle clients.

    ##pdo_sqlite

    • ##Usesqlite3_prepare_v2()andsqlite3_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

Related labels:
source:php.cn
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
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!