Modern PHP 8 Essentials
Write and run modern PHP 8 directly in your browser. Master typed functions, associative arrays, match expressions, classes, PDO security habits, and an auto-graded capstone.
What you'll build & master
- ✓ Write clean PHP 8 with strict types, string interpolation, and null coalescing
- ✓ Use modern match expressions, foreach loops, and array_map/array_filter
- ✓ Build typed functions and PHP 8 classes with constructor property promotion
- ✓ Prevent SQL injection and XSS using prepared statements and htmlspecialchars
- ✓ Pass an auto-graded PHP 8 capstone challenge in the browser
Course Syllabus
PHP 8 Basics
- 17 min
Variables, Types & String Interpolation
Run your first PHP 8 script in the browser, declare $variables cleanly, and interpolate values inside double-quoted strings.
- 28 min
Control Flow, match() & foreach Loops
Branch cleanly with PHP 8 match expressions and iterate over lists and key-value arrays using foreach.
Functions & Arrays
- 18 min
Arrays, array_filter & array_map
Work with indexed and associative arrays and transform collections cleanly using PHP 8 arrow functions (fn).
- 29 min
Typed Functions & PHP 8 Classes
Write self-documenting PHP 8 functions with parameter/return types and concise classes using constructor property promotion.
Web & Security
- 18 min
JSON APIs & Web Security Basics
Encode and decode JSON cleanly, prevent XSS with htmlspecialchars(), and stop SQL injection with PDO prepared statements.
- 27 min
Dates & Immutability with DateTimeImmutable
Work with dates, timezones, and intervals safely using PHP's DateTimeImmutable instead of mutable DateTime.
- 38 min
Namespaces, Composer & PSR-4 Autoloading
Organize real PHP applications cleanly with namespaces, use imports, Composer dependencies, and PSR-4 autoloading.
Core Standard Library
Modern PHP 8 Features
Object-Oriented PHP
- 18 min
Interfaces & Traits
Define clean contracts with PHP interfaces and share reusable behavior across unrelated classes using traits.
- 28 min
Exceptions & Resilient Error Handling
Catch specific exception types with try/catch/finally, throw descriptive InvalidArgumentException errors, and keep apps crash-proof.