Est. 1995 Beginner

PHP

A popular general-purpose scripting language that is especially suited to web development, powering over 77% of websites with server-side code.

Created by Rasmus Lerdorf

Paradigm Multi-paradigm: Imperative, Object-Oriented, Functional, Procedural, Reflective
Typing Dynamic, Weak (with optional type hints)
First Appeared 1995
Latest Version PHP 8.4 (2024)

PHP (PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development. It powers approximately 77% of all websites with known server-side programming languages, making it one of the most successful programming languages in history.

History & Origins

In 1994, Rasmus Lerdorf created a set of Common Gateway Interface (CGI) programs in C to maintain his personal homepage and track visits to his online resume. He called these tools “Personal Home Page Tools,” later releasing them as PHP/FI (Personal Home Page / Forms Interpreter) in 1995.

The language gained significant momentum when Andi Gutmans and Zeev Suraski rewrote the parser in 1997, creating PHP 3. They later founded Zend Technologies and created the Zend Engine that would power PHP 4 and beyond. The recursive acronym was also established: “PHP: Hypertext Preprocessor.”

The Web’s Dominant Language

PHP became the de facto language for web development in the late 1990s and 2000s because of several key advantages:

  • Easy to Learn: Forgiving syntax and immediate feedback made it accessible to beginners
  • Embedded in HTML: PHP code could be mixed directly with HTML
  • Cheap Hosting: Shared hosting providers universally supported PHP
  • LAMP Stack: The Linux-Apache-MySQL-PHP stack became the standard web infrastructure

PHP Renaissance

After years of criticism for inconsistent design choices, PHP experienced a remarkable transformation starting with PHP 7 in 2015:

PHP 7 (2015) - The Performance Revolution

  • 2x Performance Improvement: The new Zend Engine 3.0 doubled execution speed
  • Scalar Type Declarations: Optional strict typing for parameters
  • Return Type Declarations: Specify function return types
  • Null Coalescing Operator: ?? for handling null values cleanly
  • Spaceship Operator: <=> for three-way comparison

PHP 8 (2020) - Modern Language Features

  • JIT Compiler: Just-In-Time compilation for performance-critical code
  • Named Arguments: Pass arguments by name, not position
  • Attributes: Native annotations replacing docblock comments
  • Union Types: Declare multiple possible types
  • Match Expression: More powerful alternative to switch statements
  • Constructor Property Promotion: Reduce boilerplate in classes
  • Nullsafe Operator: ?-> for null-safe method chaining

PHP 8.4 (2024) - Latest Release

  • Property Hooks: Define getter/setter logic inline with properties
  • Asymmetric Visibility: Different visibility for reading vs writing properties
  • New Array Functions: array_find(), array_any(), array_all()
  • Lazy Objects: Deferred object initialization

Modern PHP Ecosystem

Frameworks

  • Laravel: The most popular PHP framework, known for elegant syntax and developer experience
  • Symfony: Enterprise-grade framework with reusable components
  • Laminas (formerly Zend Framework): Enterprise PHP framework
  • Slim: Micro-framework for APIs and small applications

Package Management

  • Composer: The standard package manager, with over 350,000 packages on Packagist
  • PSR Standards: PHP Standards Recommendations ensure interoperability

Tools & Infrastructure

  • PHPUnit: The standard testing framework
  • PHPStan / Psalm: Static analysis tools catching bugs before runtime
  • PHP-FPM: FastCGI Process Manager for production deployments
  • Swoole / RoadRunner: Async servers for high-performance applications

Why PHP Still Matters

Despite competition from Node.js, Python, and Go, PHP remains relevant because:

  1. Massive Installed Base: Billions of lines of PHP code power critical infrastructure
  2. Continuous Improvement: PHP 8.x is genuinely a modern, well-designed language
  3. WordPress: Powers 40%+ of all websites, creating constant demand for PHP developers
  4. Laravel: Continues to be one of the most-loved web frameworks
  5. Low Barrier to Entry: Easy deployment on virtually any web host
  6. Performance: Modern PHP rivals or exceeds many alternatives in benchmarks

PHP may never be the trendiest language, but its combination of ubiquity, continuous improvement, and practical focus ensures it will remain a cornerstone of web development for years to come.

Timeline

1994
Rasmus Lerdorf creates 'Personal Home Page Tools' for tracking visits to his online resume
1995
PHP/FI (Personal Home Page / Forms Interpreter) released as open source
1998
PHP 3 released - complete rewrite by Andi Gutmans and Zeev Suraski, renamed to 'PHP: Hypertext Preprocessor'
2000
PHP 4 released with Zend Engine 1.0, improving performance significantly
2004
PHP 5 released with Zend Engine II, introducing true object-oriented programming features
2015
PHP 7 released - major performance improvement (2x faster), scalar type declarations, return types
2020
PHP 8 released with JIT compiler, named arguments, attributes, union types, match expressions
2022
PHP 8.2 released with readonly classes, true/false/null as standalone types
2024
PHP 8.4 released with property hooks, asymmetric visibility, new array functions

Notable Uses & Legacy

WordPress

The world's most popular CMS, powering over 40% of all websites on the internet, is built entirely in PHP.

Facebook

Facebook was originally built in PHP and later developed Hack, a PHP dialect with static typing, to handle its massive scale.

Wikipedia

MediaWiki, the software powering Wikipedia and thousands of other wikis, is written in PHP.

Laravel & Symfony

Major PHP frameworks that power millions of web applications, from startups to enterprise systems.

Magento / Adobe Commerce

Leading e-commerce platform handling billions in online transactions annually.

Slack

The popular team communication platform was originally built with PHP before parts were migrated to other technologies.

Language Influence

Influenced By

Perl C Java Tcl Smalltalk

Influenced

Hack P++

Running Today

Run examples using the official Docker image:

docker pull php:8.3-cli-alpine

Example usage:

docker run --rm -v $(pwd):/app -w /app php:8.3-cli-alpine php hello.php

Topics Covered

Last updated: