<?php>

PHP

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.

v8.3+ 77% of Web WordPress Engine Laravel
30+
Years Old
77%
Web Share
1M+
Developers
300K+
Packagist Packages
The Language That Runs the 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, World!
// 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.

Modern PHP (8.x)
<?
Embedded in HTML
PHP code lives directly inside HTML files. <?php ... ?> tags let you mix logic and markup seamlessly.
📦
Huge Ecosystem
Composer package manager with 300K+ packages on Packagist. Laravel, Symfony, PHPUnit, Doctrine, and thousands more.
T:
Type System (8.x)
Union types, intersection types, typed properties, return types, enum, readonly classes. PHP 8 has a real type system.
JIT
JIT Compilation
PHP 8.0 introduced a Just-In-Time compiler via the Tracing JIT in OPcache. Up to 3x faster for CPU-bound workloads.
~>
Fibers (8.1)
Lightweight cooperative concurrency. Fibers enable async I/O without callbacks, powering frameworks like ReactPHP and Amp.
{ }
Enums
First-class enums in PHP 8.1. Backed enums with string or int values. Implement interfaces. Have methods.
=>
Match Expressions
match($x) { 1 => 'one', 2 => 'two' } — strict comparison, no fall-through, returns a value.
:
Named Arguments
array_slice($arr, length: 2, offset: 1) — skip optional params, self-documenting function calls.
#[ ]
Attributes
Native metadata annotations: #[Route('/users')]. Replaces docblock annotations. Compile-time validated.
The Invisible Engine of the Web

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.

Dive Deeper