8 lessons · PHP 8.5 runs in your browser · No account

Learn PHP

PHP is an open source scripting language used mostly to build websites, and its code can sit inside an HTML page. Chapter 1 teaches you to print text, store values in variables and work with strings and numbers.

PHP
<?php
$name = "World";
echo "Hello, {$name}!\n";
Output
Hello, World!

Every lesson looks like this. Edit the code, press Run, read the real output.

What you'll learn

Frequently asked questions

What is PHP used for?
PHP is used mainly for server-side web development. It collects form data, builds pages from databases and sends cookies. It also runs command-line scripts and can output JSON, XML, images and PDF files.
What does PHP stand for?
PHP stands for PHP: Hypertext Preprocessor, a recursive acronym. Rasmus Lerdorf created PHP in 1994 as Personal Home Page Tools, a set of programs written in C. The current meaning dates from PHP 3.0, announced in June 1998.
Is PHP outdated?
No, PHP is still maintained. PHP 8.6.0 came out on November 19, 2026, with bug fixes until December 31, 2028, and critical security fixes until December 31, 2030.
Is PHP hard to learn?
PHP is not especially hard to start with. A complete first script fits on one line. When an error in your code stops PHP, the message names the file and the line where PHP stopped, which shows you where to look first.
Is PHP a frontend or backend language?
PHP is mainly a backend language. It runs on the server, and the browser receives only the result of running the script, usually HTML. Client-side JavaScript, by contrast, runs inside the page itself.
What is the difference between PHP and HTML?
Unlike HTML, PHP is a programming language. HTML is markup, and by default the server sends a .html file unchanged on every request. In a .php file, PHP code mixed into the HTML runs on the server and can build a different page each time, for example from form data or a database.
Do I need to install PHP to take this course?
No, every runnable example and exercise in the PHP course works on the page with nothing to install. The lesson pages run PHP 8.5.12 and point out any output that differs in PHP 8.6. The Installing PHP lesson shows how to set up PHP on Windows, macOS and Linux.