php
What is a .php file?
application/x-httpd-php
PHP (.php) is a plain-text source file for the PHP language — a dynamically typed, server-side scripting language designed for web development, embeddable in HTML. Modern PHP supports classes, namespaces, type declarations, and closures, and powers a large share of web back-ends and CMS platforms.
How to use a .php file
Use an example .php file to test syntax highlighters, the PHP interpreter and linters (PHP_CodeSniffer, PHPStan), formatters, and parser or language-detection tooling.
Download example .php files
- PHP — Hello WorldThe classic hello-world in PHP — an opening tag and echo — for testing highlighters, the PHP interpreter, and parsers.
- PHP — Invoice (enum, class, promoted properties)A realistic modern-PHP snippet with strict types, a namespace, a backed enum, a final class with constructor-promoted readonly properties, and array_reduce with an arrow function — for testing highlighters, PHPStan, and parsers.