Image for post: PHP 7 features for each version

PHP 7 features for each version

PHP 8 is out and now we have all PHP 7 versions with all features. They are a lot and we have to be able to understand how PHP has changed and how we can take advantage of all these features. Or at least we must know how they can work and see if we can use them in our project.

PHP 7.0

PHP 7 came with the 3rd December 2015. The support ended 10 January 2019, With this first release of PHP 7, the codebase uses less memory and gives you even more performance. The response is even 2x faster than before and it works great both on Apache and Nginx.

PHP 7.1

The first release after the great jump from version 5.6 to 7, came out on the 1st December 2016, support ended the 1 December 2019.

  • iterable pseudo type
  • Closure from callable
  • Square bracket syntax for list()
  • Support for keys in list
  • Class constant visibility
  • Nullable types
  • Void functions
  • Catching Multiple Exception Types
  • Too few arguments exception

PHP 7.2

This version came out on 30 November 2017, support ended on 30 November 2020.

  • New object type
  • Extension loading by name
  • Abstract method overriding
  • Sodium is now a core extension
  • Argon2 in password hash
  • Extended string types for PDO
  • Additional emulated prepares debugging information for PDO
  • Support for extended operations in LDAP
  • Address Information additions to the Sockets extension
  • Parameter type widening
  • Allow a trailing comma for grouped namespaces
  • proc_nice() support on Windows
  • Enhancements to the EXIF extension
  • New features in PCRE
  • SQLite3 allows writing BLOBs
  • Oracle OCI8 Transparent Application Failover Callbacks
  • Enhancements to the ZIP extension

PHP 7.3

This version came out on 6 December 2018, support ends on 6 December 2021.

  • PHP Core
    • More Flexible Heredoc and Nowdoc Syntax
    • Array Destructuring supports Reference Assignments
    • Instanceof Operator accepts Literals
    • CompileError Exception instead of some Compilation Errors
    • Trailing Commas are allowed in Calls
    • Argon2id Support
    • FastCGI Process Manager
    • BC Math Functions
    • Lightweight Directory Access Protocol
  • Multibyte String Functions
    • Full Case-Mapping and Case-Folding Support
    • Case-Insensitive String Operations use Case-Folding
    • MB_CASE_TITLE performs Title-Case Conversion
    • Unicode 11 Support
    • Long String Support
    • Performance of the Multibyte String extension has been significantly improved across the board
    • Named Captures Support
    • Support for the completion_append_character and completion_suppress_append options has been added to readline_info().

PHP 7.4

This version came out on 28 November 2019, support ends on 28 November 2022.

  • PHP Core
    • ​​​​​​​Typed properties
    • Arrow functions
    • Limited return type covariance and argument type contravariance
    • Null coalescing assignment operator
    • Unpacking inside arrays (same as spread operator in Javascript ES6!)
    • Numeric literal separator
    • Weak references
    • Allow exceptions from __toString()
    • CURLFile now supports stream wrappers in addition to plain file names, if the extension has been built against libcurl >= 7.56.0.
    • The FILTER_VALIDATE_FLOAT filter now supports the min_range and max_range options, with the same semantics as FILTER_VALIDATE_INT.
    • FFI is a new extension, which provides a simple way to call native functions, access native variables, and create/access data structures defined in C libraries.
    • GD: added the IMG_FILTER_SCATTER image filter to apply a scatter filter to images.
    • Hash: added crc32c hash using Castagnoli's polynomial. This CRC32 variant is used by storage systems, such as iSCSI, SCTP, Btrfs, and ext4.
    • Multibyte String: added the mb_str_split() function, which provides the same functionality as str_split(), but operating on code points rather than bytes.
    • OPcache: support for preloading code has been added.
    • Regular Expressions (Perl-Compatible)
    • PDO news about username and password in the DSN string and question mark\s in the queries
    • PDO_OCI: PDOStatement::getColumnMeta() is now available.
    • PDO_SQLite: get abd set attribute added
    • SQLite3  
  • Standard
    • strip_tags() with array of tag names
    • Custom object serialization
    • Array merge functions without arguments: array_merge() and array_merge_recursive() may now be called without any arguments, in which case they will return an empty array. 
    • proc_open() function now accepts an array instead of a string for the command
    • argon2i(d) without libargon

Resources