What Is PHP?

1.What Is PHP?

M

In this chapter

We'll learn what PHP is, where it came from, what job it does on the web, and how it compares with JavaScript, Java and Python — so you know exactly what you're about to learn and why.

10–12 min

The Problem in Real Life

It's Mia's first day at BookBay, a small startup that makes online booking for small businesses — barbers, gyms, clinics. She has just finished college. She has never written a single line of code.

At 10 o'clock, Olivia Anderson, the founder, walks in smiling. "We just signed our first paying customer — Tom's Barbershop. In six weeks, Tom's customers book their haircuts online. No more paper diary." She looks around the room. "Six weeks. That's Launch Day."

Marcus, the senior engineer, pulls a chair next to Mia's desk. "You'll help me build it," he says. "In PHP." Mia nods, then quietly types "what is PHP" into a search box.

M

I don't even know what PHP is — and in six weeks I'm supposed to help build a booking website with it?

Mia

What a Website Needs vs. What PHP Does

A page alone isn't enough

A booking site must remember bookings, check free slots and react to each customer — a fixed page can't do that.

Someone must do the work

Every time a customer books, some program has to check, save and answer. That program is written in a language like PHP.

Many languages exist

JavaScript, Java, Python and PHP can all do this work. Why does BookBay use PHP?

What Is PHP?

First, two words you'll see everywhere. Code is a set of written instructions for a computer. A programming language is the set of words and rules you use to write those instructions — a bit like English has words and grammar. The computer is very strict: one wrong character, and it refuses to understand.

PHP is a programming language made for the web. Its main job is to run on a server — a computer somewhere on the internet that waits for requests — and build the answer each visitor gets. When a customer opens Tom's booking page, PHP can look at today's date, check which slots are already taken, and create a page that shows only the free ones. A second later, for the next customer, it builds a new page with the latest slots.

That's the big idea: a plain web page is like a printed menu — everyone sees the same thing. A page built by PHP is like a waiter who listens to each customer and brings exactly what they asked for.

PHP does three kinds of work for a website:

  • Building pages — PHP can create the HTML that a browser shows, with the right data filled in. (HTML is the language that describes what a web page shows: headings, text, buttons.)
  • Handling data — saving a booking, checking a password, reading a list of free slots from a database (an organised store of data). This is the part users never see, and it's most of the real work.
  • Talking to other systems — sending the SMS reminder, taking a card payment, answering a mobile app that asks "which slots are free?"

Where PHP does its work

Customer's browser

"Show me Tom's free slots"

sends a request

Server running PHP

checks bookings, builds the answer

reads and saves data

Database

every booking, saved

This is what PHP code looks like. Don't worry about understanding every character yet — the next Act explains each one. Just notice that it reads almost like English: it remembers a name and a time, then writes a sentence with them.

Your first look at PHP
<?php
$shop = "Tom's Barbershop";
$time = "3:00 PM";
echo "Your booking at $shop is confirmed for $time.";

Output: Your booking at Tom's Barbershop is confirmed for 3:00 PM.

A short history: In 1994, a programmer named Rasmus Lerdorf wrote some small tools to see who visited his personal web page. He called them "Personal Home Page Tools" — that's where the letters PHP come from. He shared them, people added to them, and they grew into a real language. In 1998 the name changed to "PHP: Hypertext Preprocessor" (hypertext means web pages; a preprocessor works on something before it's shown). Big versions followed: PHP 5 in 2004, a much faster PHP 7 in 2015, PHP 8 in 2020 — and in this course we use PHP 8.5, released in November 2025.

Where PHP is used today: PHP runs a large part of the web. WordPress, the tool behind more than 40% of all websites, is written in PHP. So is Wikipedia. Facebook started as a PHP website. Thousands of companies build their products with PHP frameworks like Laravel and Symfony — frameworks are ready-made toolkits that save you from writing everything yourself. You'll meet Laravel in the next course, after you know PHP itself.

PHP compared with other languages: The table below puts PHP next to three languages you'll hear about at work. They are all real programming languages — the difference is mostly where they usually run and what people mostly build with them.

Table — Four popular languages, side by side
LanguageWhere it usually runsWhat people mostly build with it
PHPOn the serverWebsites and web applications, APIs — the backend
JavaScriptIn the browser (and on servers, with Node.js)Interactive pages; also backends
JavaOn servers, Android phonesLarge business systems, Android apps
PythonOn servers and personal computersData, AI, automation; also backends

All four can build a backend. PHP was made for the web from day one, so running a website is what it does most naturally.

A note on what this course covers: PHP can build the visible part of a website too — the pages, the layout, what the customer sees. That part is called the frontend. The part that runs on the server — the logic, the data, the checks, the answers — is called the backend. This course teaches PHP from the backend side. You'll see a little HTML when PHP sends a page, but we won't teach how to design pages. We focus on what happens on the server.

Key Takeaway

PHP is a programming language that runs on a server. For every request, it can check data, make decisions and build a fresh answer — a page, a saved booking, or data for another system. That server-side work is the backend, and it's what this course teaches.

Why This Matters

Everything Mia builds in the next six weeks — showing free slots, saving a booking, logging barbers in — is PHP running on a server. Knowing what PHP is for makes every later lesson easier: each new feature is just another job the server does when a request arrives.

It also matters for your career. Because so much of the web runs on PHP, there is a lot of real work for PHP developers — new products, and many existing ones that need someone who understands them.

Marcus slides a laptop over. "Here's the first file of the booking page." Mia double-clicks it, expecting a web page. Instead, the browser fills with strange code. Why didn't it work? That's the next chapter.