PHP – Basic Structure

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

PHP code are executed on the server, and the result is returned to the browser as plain HTML.

In PHP, all user-defined functions, classes, and keywords (e.g. if, else, while, echo, etc.) are case-insensitive.

However; in PHP, all variables are case-sensitive.

PHP files have extension “.php”

The official PHP website is: http://www.php.net

<!DOCTYPE html>
<html>
<body>

<?php

// This is a one-line c++ style comment

# This is a one-line shell-style comment

/* This is a multi line comment
yet another line of comment */

echo "Hello World!";
?>

</body>
</html>

Notice:
The PHP code is tagged inside:

<?php
... your php code ... ;
?>

or with the short notation
<?
... your php code ... ;
?>