Hello World!

Traditionally the first post created for a WordPress “blog” is entitled “Hello World!”.

Here’s a quick test for you PHP developers.

What is the smallest valid example of a PHP program that will produce “Hello World!” when run? 

Answer

Hello World!

Try it for yourself

Is this the smallest valid PHP for a “Hello World!” program?

  1. Create a file containing Hello World! I called mine “hw”
  2. Demonstrate its contents: type hw
  3. Invoke it using the PHP interpreter: php hw

See also

Hello, World – the most basic computer program

Wikipedia: Hello world program

100 pgmg offences – 1. Develop buggy code