"Hello, World!" in PHP

#hello-world #php

Written by Anders Marzi Tornblad

How to do "Hello, World!" in PHP.

// hello-world.php
echo 'Hello, World!';

Even though PHP is mostly used for adding server-side functionality to web pages, PHP is actually a self-containing language that can be run on a lot of different platforms, both in a web server and completely stand-alone. When PHP is run inside a web server, the echo statement renders output to the response of an HTTP request. When PHP is run from the command line, it prints to the console.

For more "Hello, World!" examples, go to the Hello World category.