Skip to content
Novus Examples
php69 B

PHP — Hello World

The classic hello-world in PHP — an opening tag and echo — for testing highlighters, the PHP interpreter, and parsers.

Preview — first 5 linesphp
<?php
// The classic first program, in PHP.

echo "Hello, world!\n";

Specifications

Language
PHP
Kind
hello-world
Lines
4
Encoding
UTF-8
Line Endings
LF

What is a .php file?

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 this 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.

Generated by generation/code_samples.py. Free for any use, no attribution required — license.