Syllabus & Study Plan

What the PHP course covers, what you'll be able to do by the end, and a suggested ten-week schedule with a checkpoint each week. Install PHP first (lesson 2) — writing and running code yourself is the fastest way to learn.

Who this course is for

Beginners who want to build dynamic websites; front-end developers adding a back end to their skills; WordPress users who want to understand the code behind themes and plugins; and programmers from other languages who want to write modern, idiomatic PHP before moving on to Laravel or Symfony.

Learning outcomes

By the end of the course you will be able to:

  1. Install PHP, run scripts from the command line, and serve pages with the built-in web server.
  2. Use PHP's types, operators and type juggling rules correctly, with strict comparisons and strict types.
  3. Write clear control flow with if, match and loops, and process text with string functions, printf, mb_* functions and regular expressions.
  4. Work fluently with indexed, associative and nested arrays using the array function library.
  5. Write typed functions with default, named and variadic parameters, closures, arrow functions and the pipe operator.
  6. Design classes with constructors, visibility, property hooks, inheritance, interfaces, traits, enums and immutable value objects, organised with namespaces and autoloading.
  7. Handle errors with exceptions and process large data lazily with generators.
  8. Build web pages that handle forms, validation, escaping, sessions, cookies, redirects, uploads, templates and routing.
  9. Read and write files, JSON and dates, and use databases safely with PDO, prepared statements and transactions.
  10. Protect applications against common attacks, manage dependencies with Composer, write PHPUnit tests, and follow modern PHP best practices.

Course outline

PartLessonsFocus
1. Getting Started01–04Installing PHP, scripts, PHP and the web
2. Basics05–11Syntax, variables, types, numbers, conversion, operators, constants
3. Control Flow12–15if, switch, match, loops
4. Strings16–20String functions, formatting, Unicode, regular expressions
5. Arrays21–26Lists, maps, array functions, sorting, nesting, destructuring
6. Functions27–32Parameters, types, scope, closures, recursion
7. Object-Oriented PHP33–43Classes, hooks, inheritance, interfaces, traits, enums, namespaces
8. Errors & Iteration44–45Exceptions, generators
9. PHP on the Web46–53Forms, escaping, sessions, cookies, headers, uploads, templates, routing
10. Files, Data & Databases54–59Files, JSON, dates, PDO, transactions, security
11. Modern PHP & Projects60–64Composer, PHPUnit, PHP 8.5, best practices, final project

Ten-week study plan

About five to seven hours a week. Each week ends with a checkpoint — if you can do it comfortably, move on.

WeekLessonsCheckpoint
101–09Write a script that converts between units and validates its input with filter_var.
210–15Build a page on the built-in server that shows a times table for a number given in the URL.
316–20Write a text analyser that counts words, finds the longest one and prints a formatted report.
421–26Summarise a list of sales records: totals per region, sorted, with the top product.
527–32Refactor earlier scripts into small, typed functions; use closures with array_map and usort.
633–39Model a library with Book, Member and Loan classes and an interface for notifications.
740–45Add enums and immutable value objects to your model, organise it with namespaces and an autoloader, and handle errors with custom exceptions.
846–53Build a contact form with validation, CSRF-safe flash messages and a front-controller router.
954–59Store your contact form's messages in SQLite with prepared statements, and export them as CSV and JSON.
1060–64Move your code to Composer autoloading, add PHPUnit tests, and complete the guestbook project.

Final project: complete at least three of the guestbook's challenges (lesson 64), add tests for its validation and database code, then take the quiz and aim for 25 out of 30 or better.

Faster tracks

  • Know another language? Skim Parts 1–3, then focus on type juggling (09), arrays (21–26), the web part (46–53) and PDO (57–58).
  • Returning to PHP after years away? Read lessons 09, 13, 29, 31, 34–35, 40–41, 62 and 63 for what's changed since PHP 7.
  • Heading for Laravel or Symfony? Make sure you're comfortable with Parts 7, 9 and 11 — frameworks build directly on namespaces, autoloading, routing, templates, dependency injection and Composer.

Practice resources

  • Playground — a starter script to experiment with.
  • Exercises — 44 fill-in-the-blank tasks and five programming challenges.
  • Quiz — 30 questions with explanations.