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
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:
- Massive Installed Base: Billions of lines of PHP code power critical infrastructure
- Continuous Improvement: PHP 8.x is genuinely a modern, well-designed language
- WordPress: Powers 40%+ of all websites, creating constant demand for PHP developers
- Laravel: Continues to be one of the most-loved web frameworks
- Low Barrier to Entry: Easy deployment on virtually any web host
- 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
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 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
Influenced
Running Today
Run examples using the official Docker image:
docker pull php:8.3-cli-alpineExample usage:
docker run --rm -v $(pwd):/app -w /app php:8.3-cli-alpine php hello.php