From PHP 4 to PHP 8: How Far the Language Has Come

PHP has quietly transformed from a loosely-typed templating language into a genuinely modern, reasonably strict language — a shift most people who haven’t touched PHP since the early 2000s completely miss.

PHP 4/5: The Wild West Era

No real object model until PHP 5, no namespaces, no type hints beyond arrays, and the infamous mysql_* functions with zero built-in SQL injection protection. Function names were (and still are) inconsistently capitalized and ordered — a legacy that never got fully cleaned up.

PHP 7: The Performance and Type Revolution

PHP 7 doubled performance in many workloads virtually overnight thanks to a rewritten engine, and introduced scalar type hints and return types — the first real step toward a statically-analyzable PHP.

PHP 8.x: Modern Language Features

// Named arguments, union types, match expressions, enums, readonly properties -
// all things PHP simply didn't have a decade ago
function createUser(string $name, int $age, ?string $email = null): User { /* ... */ }

createUser(name: "Alice", age: 30); // named arguments

$result = match(true) {
    $age < 13 => 'child',
    $age < 18 => 'teen',
    default => 'adult',
};

A developer who last touched PHP 4 or 5 would barely recognize idiomatic PHP 8 code — the language earned a reputation in the 2000s that it has spent the last decade genuinely outgrowing.