Skip to content
Learn at your own pace

Learn PHP

Learn server-side programming, work with forms and databases, and build a practical PHP application.

A student connects colorful building blocks beside a laptop, illustrating a sequence of programming instructions.
One small step becomes a working program.
24lessons in 6 stages
48practice exercises
24project milestones
96quiz questions
96review cards

A clear place to start

PHP runs on a server. A browser sends a request, PHP reads data and applies rules, then the server returns HTML or a data response.

What you need first

Understand a basic HTML page and form. Begin with variables, conditions, loops, and functions in the starter example before working on requests and databases.

Start with these ideas

  1. A variable such as $name stores a value. An array can store a reading list or map a book ID to its details.
  2. A function accepts inputs and returns a result. Keep a fee calculation separate from displaying a page.
  3. Form input begins as untrusted data. Validation checks its meaning; escaping makes text safe for its output context.

Connect it to a real project

Build a reading list: start with an array of books, add validated forms, save records to a database, then protect each reader’s private entries.

Study one concept at a time. Explain its everyday example in your own words, predict the worked example’s result, then try a small change. Use practice and quiz feedback to decide what to revisit. You can spread a lesson across several study sessions.

Set up your environment Tools, setup steps, and completion requirements

Start with the ideas above, then set up the tools below. Return to the starter example whenever a new term feels unfamiliar.

text
php --version
php -l lesson.php
php lesson.php
# Install Composer separately, then use composer init for your portfolio.
# Run examples locally. Never expose the development server publicly.

A free account saves your progress, notes, exercise evidence and spaced review cards. To complete a lesson, score at least 80% on its quiz, finish both exercises and the project checklist, and submit your project link with a reflection. Project evidence is self-reported; use the final portfolio rubrics to seek an independent code review.

Your PHP learning path

Work through these foundations in order, then bring them together in a project.

24 of 24 lessons · follow the stages in order

Start with a small example

The function accepts a name and returns a greeting. Running the file with PHP prints Hello, Developer!.

<?php

function greeting(string $name): string
{
    return "Hello, {$name}!";
}

echo greeting('Developer');

Try it yourself

Add a second parameter for a course name and include it in the greeting.

Put it into practice

Build a reading list

Create a small application that stores books you want to read.

  1. Render a list of books from an array.
  2. Add a form with validation for a book title and author.
  3. Save books to a database with prepared statements.
  4. Add an edit action and a way to mark a book as finished.
Keep exploring

Find your next course

Choose a language, build on it with a framework, or explore AI and search.

Showing 6 of 17 courses