What is PHP?

What PHP is, where it runs, and why it still powers much of the web.

  • Beginner
  • 3 min read
  • Updated 17 Oct 2026

What you will learn

  • Explain what server-side code means
  • Describe what happens when a browser requests a PHP page
  • Recognise where PHP is used today

Before you start

  • None. This is the first lesson.

PHP is a programming language that runs on a web server. It builds a response, usually an HTML page, and sends the finished result to the browser. The visitor never sees your PHP code, only what it produces.

The name originally stood for Personal Home Page. Today it is a recursive acronym, PHP: Hypertext Preprocessor, and it is a mature, fast, general-purpose language.

Server-side versus client-side

Code on the web runs in one of two places:

Runs onExamplesCan do
The serverPHP, Python, Node.jsRead databases, check passwords, send email, build pages
The browser (client)JavaScriptReact to clicks, update the page without reloading

Because PHP runs on the server, it can do things the browser must never be trusted with, such as checking whether a password is correct or reading private data from a database.

What happens when someone opens a PHP page

  1. The browser requests a URL, for example https://example.com/products.php.
  2. The web server sees the .php extension and passes the file to the PHP engine.
  3. PHP runs the code from top to bottom. It might read a database, check the date or read form input.
  4. Everything the script outputs, usually HTML, becomes the response.
  5. The browser receives plain HTML and displays it.

Here is a complete PHP page:

PHP
<!DOCTYPE html>
<html lang="en">
<body>
    <h1>Welcome</h1>
    <p>Today is <?php echo date('l'); ?>.</p>
</body>
</html>

The browser receives something like <p>Today is Monday.</p>. The <?php ... ?> part ran on the server and was replaced by its output.

PHP can also run without a web server, from the terminal. That is how you will run most examples in this course, and how tools such as Composer and WP-CLI work.

Where PHP is used

  • WordPress powers a large share of all websites, and it is written in PHP.
  • Frameworks such as Laravel and Symfony build everything from shops to banking back offices.
  • Large sites such as Wikipedia run on PHP.
  • Command-line tools and APIs are often written in PHP too.

Why learn PHP in 2026

Modern PHP is not the PHP of old tutorials. Versions 8.x added a JIT compiler, typed properties, enums, match expressions, named arguments and readonly classes. It is fast, has excellent documentation, and runs on almost every web host.

It is also a practical first back-end language: you can see results in a browser within minutes, and the jobs market for PHP and WordPress work is large.

When you search for help, add the version, for example "php 8 string functions". Older answers often use outdated or insecure patterns.

Summary

  • PHP runs on the server and sends the finished result to the browser.
  • The browser never sees PHP code, only its output.
  • PHP is used by WordPress, Laravel, Symfony and many large sites.
  • This course uses PHP 8.1 or newer.

In the next lesson you will install PHP and run your first script.

Further reading