PHP Course
PHP is the server-side language behind WordPress, Wikipedia, Laravel and Symfony applications and a large share of the web. This course teaches modern PHP 8.5 — typed, object-oriented and secure — from your first script through arrays, functions and classes to forms, sessions, databases with PDO, Composer and testing, finishing with a complete guestbook web application.
What you'll learn
The course has 64 lessons in eleven parts:
- Getting Started — what PHP is, installing it, running scripts, and how PHP serves web pages.
- Basics — syntax, variables, types, numbers, type juggling, operators and constants.
- Control Flow —
if,switchandmatch, and loops. - Strings — string functions,
printfformatting, Unicode withmb_*, and regular expressions. - Arrays — lists, associative arrays, array functions, sorting, nested data, destructuring and spread.
- Functions — parameters, named arguments, type declarations, scope, closures, the pipe operator and recursion.
- Object-Oriented PHP — classes, constructors, property hooks, inheritance, interfaces, traits, enums, readonly objects and namespaces.
- Errors & Iteration — exceptions and generators.
- PHP on the Web — forms, validation and escaping, sessions, cookies, headers, uploads, templates and routing.
- Files, Data & Databases — files, JSON and HTTP, dates, PDO, prepared statements, transactions and security.
- Modern PHP & Projects — Composer, PHPUnit, what's new in PHP 8.5, debugging and a final project.
Every example in the course was run with PHP 8.5 and the output shown is exactly what it produced. Command-line examples ran with the php command; web examples ran on PHP's built-in web server, with each request and the response the browser received shown on the page. The Try it yourself editors let you change any example and copy it to run on your own computer.
No previous programming experience is required, though knowing a little HTML helps with the web lessons.
Practice
- Playground — a starter script to copy and experiment with.
- Exercises — fill-in-the-blank tasks and programming challenges with solutions.
- Quiz — test your understanding across the whole course.
- Syllabus & Study Plan — learning outcomes and a week-by-week schedule.
Lessons
Getting Started
Basics
- Syntax and Comments
- Variables
- Data Types
- Numbers and Math
- Type Juggling and Conversion
- Operators
- Constants
Control Flow
Strings
Arrays
- Arrays
- Associative Arrays
- Array Functions
- Sorting Arrays
- Multidimensional Arrays
- Destructuring and Spread
Functions
- Functions
- Parameters and Arguments
- Type Declarations
- Scope and Static Variables
- Closures and Callables
- Recursion
Object-Oriented PHP
- Classes and Objects
- Constructors
- Visibility and Property Hooks
- Static Members and Class Constants
- Inheritance
- Abstract Classes and Interfaces
- Traits
- Enums
- Readonly and Immutability
- Magic Methods
- Namespaces and Autoloading
Errors & Iteration
PHP on the Web
- Handling Forms
- Validation and Escaping
- Sessions
- Cookies
- Headers, Status Codes and Redirects
- File Uploads
- Templates and Output Buffering
- Routing and Front Controllers
Files, Data & Databases
- Files and Directories
- JSON and HTTP Requests
- Dates and Times
- Databases with PDO
- Prepared Statements and Transactions
- Web Security Essentials
Modern PHP & Projects
- Composer and Packages
- Testing with PHPUnit
- What's New in PHP 8.5
- Debugging and Best Practices
- Project: A Guestbook