Language

PHP

First appeared
1995
Paradigm
Imperative, scripting, object-oriented
Toolchain
PHP 8.4.24
Container image
debian:trixie-20261027-slim + php8.4-cli 8.4.24-1~deb13u1

PHP was released in 1995 by Rasmus Lerdorf as “Personal Home Page Tools,” a set of scripts for tracking visits to his online résumé. It grew into a language for building web pages on the server, and it now runs WordPress, Wikipedia’s MediaWiki, and a large share of the web. The name now stands for “PHP: Hypertext Preprocessor.”

A PHP file starts with <?php, and every variable name starts with $. PHP’s main collection type is the array, which is an ordered map: with keys 0, 1, 2, and so on it acts as a list, and with string keys it acts as a dictionary. The standard library is large and built in, from array_sum and usort to str_getcsv. Packages from Composer, PHP’s package manager, aren’t installed here. Every program here starts with declare(strict_types=1), and the run script fails the run on any warning or deprecation notice.

Quirks

Concepts in PHP

Run the examples locally

You need Docker and Python 3. The harness builds the pinned container and runs every PHP example:

git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language php