Last updated: August 27, 2026.
PHP is a server-side language commonly used to generate HTML, process forms, work with files, and connect web applications to databases. This guide links to practical PHP examples by task.
PHP language fundamentals
- What PHP is and your first PHP script
- Variables and types
- Constants
- Arrays and multidimensional arrays
- Conditional statements
- Loops and functions
A minimal PHP page
<?php
declare(strict_types=1);
$name = 'Visitor';
$message = "Welcome, {$name}!";
?>
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>PHP example</title></head>
<body><h1><?= htmlspecialchars($message, ENT_QUOTES, 'UTF-8') ?></h1></body>
</html>Common application tasks
Use the PHP manual for complete language and extension references.