eBook - PHP 7 Explained

What you will learn:

  • Why the successor of PHP 5 is version 7
  • How to migrate with ease
  • Why PHP 7 is the fastest PHP ever
  • How to use all new features
  • What is planned for future versions
  • How PHP 7 will change how you write code

Sample Pages

Table of Contents

  • Preface
    • About the Authors
    • About thePHP.cc
    • Acknowledgments
  • Introduction
    • The Road to PHP 7
    • The Modernization of PHP
    • The Price You Pay
    • What You Get
  • Behind the Scenes
    • Compiler
    • Executor
    • Bytecode Cache
    • Debugger
  • Getting PHP 7
    • RHEL and CentOS
    • Debian
    • Ubuntu
    • macOS
    • Microsoft Windows
  • Broken code you should not have written
    • Casting INF and NAN to Integer
    • Invalid list() Usage
    • Parsing Invalid Octal Numbers
    • Architecture-Independent Bit Shifting
    • No More Cheating Using Parentheses
    • Identical Parameter Names Are No Longer Allowed
    • Variable Variables Are No Longer Allowed In global Declarations
    • Only One Default Block In switch Statements
    • Nested Output Buffers and Callbacks
    • Calling Functions and Methods With Too Few Arguments
    • Cleaned Up $this Handling
    • DateTime, DateTimeImmutable, and Microseconds
    • Bareword (Unquoted) Strings
    • Traits with Default Attribute Values
    • Using get_class() on null
    • Cleanup of the session extension
  • Type System
    • Scalar Type Declarations
    • Strict Types and Indirect Invocation
    • Object Type
    • Nullable Types
    • New iterable Super-Type
    • Return Type Declarations
    • Parameter Type Widening
    • Overriding Methods
    • Inheritance and Method Compatibility
    • Child Classes and Constructor Access
    • MySQL and Native Types
    • Typed Values from ini Files
    • The PHP_INT_MIN Constant
    • Type casting to array or object
  • Convenience
    • Group Use Declarations
    • Null Coalesce Operator
    • Combined Comparison Operator
    • preg_replace_callback_array()
    • Optional Level Parameter for dirname()
    • Cryptographically Secure Pseudo-Random Number Generator (CSPRNG)
    • Closure::call()
    • Loading extensions by name
    • PHP_OS_FAMILY Constant
  • New
    • Anonymous Classes
    • Assertions
    • Unicode Code Point Escape Syntax
    • OpenSSL
    • Output Buffering and ignore_user_abort()
    • gmp_random_seed()
    • Integer Division
    • JIT Support for Regular Expressions
    • Class Constant Visibility
    • Asynchronous Signal Handling
    • Session Garbage Collection
    • New GD functions
    • New Global Constants
    • New function stream_isatty
    • spl_object_id()
    • Enhanced Cryptography Features
  • Extended
    • Generators
    • Reflection API
    • Secure unserialize()
    • is_object() and Incomplete Classes
    • array_column()
    • Arrays as Constant Values
    • session_start()
    • Session ID Without Hashing
    • Stream-Based Compression
    • Zip
    • Short List Syntax
    • list() and ArrayAccess
    • Specifying Keys in list()
    • Negative String Offsets
    • Countable Interface and Internal Classes
    • Better random source for uniqid()
    • Improved SSL/TLS
    • Debugging PDO Prepared Statement Emulation
    • mail and mb_send_mail hardened against header injections
    • gettype and resources
    • Better syslog support with error_log
    • New hashing algorithm for passwords
  • Error Handling
    • Engine Exceptions
    • Parse Errors
    • Parse Errors in eval()ed Code
    • Recoverable Fatal Errors
    • Method Call on Non-Object
    • Errors in Extensions
    • Constructors of Internal Classes
    • Changed Error Messages
    • debug_zval_dump()
    • error_clear_last()
    • Changed E_STRICT Notices
    • setcookie() and Empty Names
    • Handling Multiple Exception Types Using a Single Catch Statement
    • Counting of non-countable objects
  • Windows
    • Consistent 64-bit Support
    • Streams
    • proc_nice()
    • proc_open()
    • getrusage()
    • memory_limit
    • Support for VT100 Console Mode
  • Breaking Changes
    • Division by Zero
    • Changes to String Handling
    • Changed Order for list() when Assigning to Array
    • New Implementation for JSON Encoding and Decoding
    • Return Value of substr() Changed in an Edge Case
    • Optional Last Parameter of mktime() Removed
    • Safe Uploads Cannot Be Disabled in cURL Extension
    • gmp_setbit() and gmp_clrbit() Return false for Negative Index
    • Deprecated Aliases Removed from the 'intl' Extension
    • PDO, PostgreSQL, and Prepared Statements
    • Removed setlocale() String Category Support
    • Removed set_socket_blocking()
    • Removed XSL ini Option xsl.security_prefs
    • Removed Support for PostScript Type1 Fonts from GD Extension
    • Tick Functions Stopped Working
    • Dynamic Calls to Scope Introspection Functions
    • More Precise Float Value Handling
    • Operators and Invalid Strings
    • Static Methods and ReflectionMethod::invoke()
    • [] Operator and Empty Strings
    • json_decode() with JSON_OBJECT_AS_ARRAY option
    • bcmod() and Fractional Numbers
    • Changes to Random Number Generation
  • Gone (or Deprecated)
    • Assigning the Result of new by Reference
    • Static Calls of Instance Methods
    • Accessing Raw POST Data
    • Hash-Sign Comments in ini Files
    • Server APIs (SAPIs)
    • ASP Tags
    • Extensions
    • Magic Quotes
    • Dynamic Extension Loading in PHP-FPM
    • call_user_method()
    • preg_replace() /e modifier
    • Support for Old Versions of Windows
    • Support for NetWare
    • PHP 4-Style Constructors
    • Eval Option for mb_ereg_replace() Deprecated
    • mbstring.func_overload Directive
    • sql.safe_mode Directive
    • track_errors Directive
    • __autoload()
    • create_function()
    • assert() with String Argument
    • (unset) Cast
    • each()
    • parse_str() without Result Argument
    • png2wbmp() and jpegwbmp()
  • Beyond PHP 7

ChangeLog

2018-04-19

Changed

  • Updated installation instructions for Debian, Ubuntu, and macOS

Fixed

  • Fixed example in “Strict Types and Indirect Invocation” section
  • Fixed example in “Using Resources as Keys” section

2018-01-31

Initial release of Second Edition that adds coverage of PHP 7.2

2017-02-07

Added

  • [] Operator and Empty Strings” section
  • DateTime, DateTimeImmutable, and Microseconds” section
  • Explanation of how inheritance affects nullable parameter type declarations
  • Explanation of nullable return type declarations
  • Information on PHP 7.1 support timeline

Changed

  • Moved discussion of inheritance rules affecting the nullability of return types after the introduction of return type declarations
  • Consistent use of stdClass instead of StdClass
  • Consistent use of “macOS” instead of “MacOS X”

Fixed

  • Discussion of coercive and strict interpretation of return type declarations
  • Type error in the example in the asynchronous signal handling section
  • Spelling mistakes

2016-11-14

Added

  • Example for ReflectionParameter::allowsNull()
  • Explanation of the difference between direct queries and prepared statements in the section on MySQL and native types

Changed

  • Examples for Reflection API related to nullable types

Fixed

  • Example in the section on the iterable super-type
  • Spelling mistakes

2016-10-04

Initial release

Authors

Book

Reviews

Buy

Download