The server-side scripting language that powers 77% of all websites with a known server-side language. Created by Rasmus Lerdorf in 1994, PHP is the engine behind WordPress, Laravel, and the modern web.
PHP was created by Rasmus Lerdorf in 1994 as a set of CGI scripts called "Personal Home Page Tools" to track visits to his online resume. What started as a simple templating hack evolved into the most widely deployed server-side language in history.
PHP is a server-side scripting language designed to be embedded directly in HTML. It runs on the server, generates HTML, and sends it to the browser. This model — request comes in, PHP processes it, HTML goes out — is the foundation of the dynamic web.
PHP powers WordPress (43% of all websites), and was the original language behind Facebook, Wikipedia, Slack, Etsy, and Mailchimp. Modern PHP (8.x) is a dramatically different language from the PHP 4/5 era: typed properties, enums, fibers, match expressions, union types, named arguments, attributes, and a JIT compiler make it a serious, modern language.
// hello.php — The classic
<?php
echo "Hello, World!";
// A modern PHP 8.x class
<?php
class User
{
public function __construct(
private readonly string $name,
private readonly string $email,
) {}
public function greet(): string
{
return "Hello, {$this->name}!";
}
}
$user = new User('Alice', 'alice@example.com');
echo $user->greet(); // Hello, Alice!
Run with php hello.php or serve via a web server. PHP's built-in server: php -S localhost:8000.
<?php ... ?> tags let you mix logic and markup seamlessly.enum, readonly classes. PHP 8 has a real type system.string or int values. Implement interfaces. Have methods.match($x) { 1 => 'one', 2 => 'two' } — strict comparison, no fall-through, returns a value.array_slice($arr, length: 2, offset: 1) — skip optional params, self-documenting function calls.#[Route('/users')]. Replaces docblock annotations. Compile-time validated.PHP runs the majority of the web. WordPress alone accounts for 43% of all websites on the internet. Add Drupal, Joomla, Magento, MediaWiki, and the millions of custom PHP applications, and PHP's share of the web is staggering.
Modern PHP (8.x) is unrecognizable from the PHP 4/5 era that earned the language its bad reputation. Today's PHP has typed properties, enums, fibers, a JIT compiler, constructor promotion, readonly classes, and match expressions. The language has grown up, and the ecosystem — Laravel, Symfony, Composer — is world-class.