Log In
Join
for free
Back To Course Home
PHP 8 Programming Tips, Tricks, and Best Practices
0% completed
Introduction
Motivation—Why PHP 8
About This Course
Section 1: PHP 8 Tips
Introduction to PHP 8 Tips
Introducing New PHP 8 OOP Features
Using Constructor Property Promotion
Working with Attributes
Incorporating match Expressions
Understanding Named Arguments
Exploring New Data Types
Improving Code Using Typed Properties
Summary: Introducing New PHP 8 OOP Features
Quiz: Introducing New PHP 8 OOP Features
Challenge: Implementing a Class with PHP 8 Advanced OOP Features
Solution: Implementing a Class with PHP 8 Advanced OOP Features
PHP 8's Functional Additions
Variadics Operator
Nullsafe Operator
Nested Ternary Operator
Arrow Functions
Uniform Variable Syntax
New Array Handling Techniques
New String Handling Techniques
Securing SQLite Databases with the Authorizer
Summary: PHP 8's Functional Additions
Quiz: PHP 8's Functional Additions
Challenge: Filtering Users in Social Network Data with PHP 8
Solution: Filtering Users in Social Network Data with PHP 8
Taking Advantage of Error-Handling Enhancements
Understanding PHP 8 Error Handling
Dealing with Warnings That Are Now Errors
Warnings Promoted to Errors in Array Handling
Understanding Notices Promoted to Warnings
Handling the @ Error Control Operator
Summary: Taking Advantage of Error-Handling Enhancements
Quiz: Taking Advantage of Error-Handling Enhancements
Challenge: Removing Errors with PHP 8 Error-Handling Techniques
Solution: Removing Errors with PHP 8 Error-Handling Techniques
Making Direct C Language Calls
Understanding FFI
Learning Where to Use FFI
Examining the FFI Class
Creating FFI Instances
Comparing Data Using FFI
Using FFI infrastructural methods
Using FFI in an Application
Working with PHP Callbacks
Summary: Making Direct C-Language Calls
Quiz: Making Direct C-Language Calls
Challenge: Data Manipulation of Foreign Function Interface in PHP
Solution: Data Manipulation of Foreign Function Interface in PHP
Section 2: PHP 8 Tricks
Introduction to PHP 8 Tricks
Discovering Potential OOP Backward-Compatibility Breaks
Discovering Core OOP Coding Differences
Working with PHP 8 Autoloading
Navigating Changes in Magic Methods
Handling Changes in Magic Methods
Taking Control of Serialization
Introducing the Serializable Interface
Understanding PHP 8 Expanded Variance Support
Handling Standard PHP Library (SPL) Changes
Summary: Discovering Potential OOP Backward-Compatibility Breaks
Quiz: Discovering Potential OOP Backward-Compatibility Breaks
Challenge: Serialize and Unserialize Different Data Structures
Solution: Serialize and Unserialize Different Data Structures
Understanding PHP 8 Functional Differences
String Handling Differences
Changes in v*prinf(), NULL Length Arguments, and the implode() Function
PHP 8 String-to-Numeric Comparison Improvements
Differences in Arithmetic, Bitwise, and Concatenation Operations
Taking Advantage of Locale Independence
Handling Arrays in PHP 8
Mastering Changes in Security Functions and Settings
Summary: Understanding PHP 8 Functional Differences
Quiz: Understanding PHP 8 Functional Differences
Challenge: Manipulating the String and Array with Advanced Methods
Solution: Manipulating the String and Array with Advanced Methods
Avoiding Traps When Using PHP 8 Extensions
Understanding the Shift from Resources to Objects
Learning about Changes to XML Extensions
Avoiding Problems with the Updated mbstring Extension
Dealing with Changes to the GD Extension
Discovering Changes to the Reflection Extension
Working with Other Extension Gotchas
Summary: Avoiding Traps When Using PHP 8 Extensions
Quiz: Avoiding Traps When Using PHP 8 Extensions
Challenge: Performing Data Operations with PHP 8 Extensions
Solution: Performing Data Operations with PHP 8 Extensions
Learning about PHP 8's Deprecated or Removed Functionality
Discovering What Has Been Removed from the Core
Discovering Other PHP 8 Usage Changes
Examining Core Deprecations
Working with Removed Functionality in PHP 8 Extensions
Deprecated or Removed Security-Related Functionality
Summary: PHP 8’s Deprecated or Removed Functionality
Quiz: PHP 8’s Deprecated or Removed Functionality
Challenge: Formatter and Hash Generators with Updated Functions
Solution: Formatter and Hash Generation with Updated Functions
Section 3: Best Practices
Introduction to PHP 8 Best Practices
Mastering PHP 8 Best Practices
Discovering Method Signature Changes
Working with the static Return Type
Working with Interfaces
Understanding PHP 8 Trait Handling Refinements
Dealing with Private Methods
Controlling Anonymous Class Usage
Understanding Changes in Namespaces
Summary: Mastering PHP 8 Best Practices
Quiz: Mastering PHP 8 Best Practices
Challenge: Data Handling Using the PDO Extension and Abstract Methods
Solution: Data Handling Using the PDO Extension and Abstract Methods
Improving Performance
Working with the JIT Compiler
Enabling the JIT Compiler
Using the JIT compiler
Speeding Up Array Handling
Implementing Stable Sort
Using Weak References to Improve Efficiency
Summary: Improving Performance
Quiz: Improving Performance
Challenge: Advanced Array Operations with Improved Performance
Solution: Advanced Array Operations with Improved Performance
Migrating Existing PHP Apps to PHP 8
Understanding Development, Staging, and Production Environments
Learning how to spot BC breaks before a migration
Developing a BC Break Scan Class
Performing the Migration
Testing and Troubleshooting the Migration
Summary: Migrating Existing PHP Apps to PHP 8
Quiz: Migrating Existing PHP Apps to PHP 8
Creating PHP 8 Applications Using Asynchronous Programming
Understanding the PHP Async Programming Model
Using the Swoole Extension
Using Selected PHP Frameworks in Async Mode
Learning About PHP 8.1 Fibers
Summary: PHP 8 Applications Using Asynchronous Programming
Quiz: PHP 8 Applications Using Asynchronous Programming
Conclusion
Wrap Up
Quiz: Mastering PHP 8 Best Practices
Test your understanding of PHP 8 best practices.
Get hands-on with 1400+ tech skills courses.
Start Free Trial