PHP History & Features
In this page:
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
// Rasmus Lerdorf's 1994 "Personal Home Page" tools grew into PHP: Hypertext Preprocessor
echo "PHP has been evolving since 1994.";
?>
Login to try C/C++/Java/PHP code in the editor
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
// Anyone can inspect or modify the PHP interpreter itself -- it's open source
echo "PHP version running here: " . phpversion();
?>
Login to try C/C++/Java/PHP code in the editor
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
// The same script runs unmodified on Windows, Linux, or macOS
echo "Directory separator on this OS: " . DIRECTORY_SEPARATOR;
?>
Login to try C/C++/Java/PHP code in the editor
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
$start = microtime(true);
for ($i = 0; $i < 100000; $i++) {
$total = $i * 2;
}
echo "Compiled bytecode ran in " . round(microtime(true) - $start, 4) . "s";
?>
Login to try C/C++/Java/PHP code in the editor
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
$value = "5" + 3;
echo $value;
// PHP converted the string "5" to a number automatically
?>
Login to try C/C++/Java/PHP code in the editor
Chapter Quiz — Complete all 13 topics to unlock
0/13 topics done
Complete these topics first: