PHP Code

PHP code consists of one or more statements (or “lines of code”) in the PHP programming language.


print “Hello World”;

The example above outputs the words “Hello World”.

  • print is a PHP command to generate output
  • Text inside quotes is known as a string, or a string literal
  • Semicolon (;) indicates the end of a PHP statement

PHP and Whitespace

PHP is very tolerant of [categorySeeAlso slug=”white-space”] — you can use tabs and line returns almost any way you like.

Example, same as the above code, except more compact:

<?php print “Hello World”; ?>