← Back to PHP Course | Chapter 1: Introduction & Basics | Lesson 2 of 13

PHP History & Features

History of PHP

Rasmus Lerdorf wrote the first version in 1994 as a small set of tools for tracking visits to his own personal homepage, hence the original name 'Personal Home Page.' It was rewritten and renamed to the recursive 'PHP: Hypertext Preprocessor' as it grew from a personal script collection into a general-purpose web language.

Example: History of PHP

php
<?php
// Rasmus Lerdorf's 1994 "Personal Home Page" tools grew into PHP: Hypertext Preprocessor
echo "PHP has been evolving since 1994.";
?>

Open Source

PHP's source code and interpreter are free to use and modify, and decades of contributions from a large open community have shaped its standard library, its performance, and major language shifts like PHP 7's speed improvements and PHP 8's JIT compiler.

Example: Open Source

php
<?php
// Anyone can inspect or modify the PHP interpreter itself -- it's open source
echo "PHP version running here: " . phpversion();
?>

Platform Independence

The same PHP script generally runs unmodified on Windows, Linux, or macOS, because PHP itself handles the platform differences (file paths, line endings, and so on) rather than pushing that burden onto your code — a big reason it became a default choice for portable web hosting.

Example: Platform Independence

php
<?php
// The same script runs unmodified on Windows, Linux, or macOS
echo "Directory separator on this OS: " . DIRECTORY_SEPARATOR;
?>

Speed and Efficiency

Modern PHP (especially PHP 7 and 8) compiles to optimized bytecode and, since PHP 8, can JIT-compile hot code paths, which closed much of the performance gap that once existed between PHP and lower-level languages for typical request/response web workloads.

Example: Speed and Efficiency

php
<?php
$start = microtime(true);
for ($i = 0; $i < 100000; $i++) {
    $total = $i * 2;
}
echo "Compiled bytecode ran in " . round(microtime(true) - $start, 4) . "s";
?>

Loose Type Language

PHP is loosely typed: you don't declare a variable's type up front, and PHP converts between types automatically when an operation needs it (e.g. combining a string and a number). This lowers the barrier to writing your first working script, though it's also why PHP added optional strict typing and type declarations in later versions for larger codebases.

Example: Loose Type Language

php
<?php
$value = "5" + 3;
echo $value;
// PHP converted the string "5" to a number automatically
?>

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.