Write a comment on this article
Because HTML is a markup language (it describes where and how content is placed on a website) and not a programming language, it doesn't contain operations and functions to interact with a user. For this reason, a programming language like PHP is required. Unlike JavaScript, which is executed in the browser, PHP runs on a webserver, far away from the client.
PHP: Hypertext Preprocessor (better known as PHP) is probably the most famous programming language for the world wide web. Its structure is similar to other programming languages like C or Java, there are variables, statements, functions, arrays and comments. But it also contains some unique features which make programming with PHP so easy and comfortable.
Variables are written with a leading $ and are declared without a datatype. The datatype will be assigned automatically at runtime by PHP's engine. Here is a simple example:
$my_number = 10; $my_decimal_number = 2.5; $my_string = "Hello World!";
PHP provides many functions like string replacement, string output, array generation, database connection, and many more. Additional libraries may be included to extend PHP's function set. Object-oriented programming is possible with PHP too.
To understand how the world of PHP works, here's a small scenario:
PHP commands are embedded in between HTML tags. Whereever PHP code should be executed, the special tags <?php (opening tag) and ?> (closing tag) are used. Example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo "Title of this site"; ?></title>
</head>
<body><?php
$a = 5;
$b = 3;
$c = $a + $b;
echo $c;
?></body>
</html>
This code would result in the following output:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Title of this site</title>
</head>
<body>8</body>
</html>
And the user would see the following result:

Now you are ready to make your first page with PHP. You can also try some of the tutorials or download free scripts.
To make websites more interesting and more interactive, databases play a big role. In combination with PHP the free database MySQL might be the most commonly used. PHP provides several functions to interact with MySQL and other databases.
Of course it's possible to install PHP locally. You will need a webserver (like Apache HTTP server) and of course PHP. Additionally your can install MySQL to work with a database. There are many installation guides online which may help you.
For more information about PHP see the resources below. Happy PHPing!
PHP, introduction
If you have a question or a problem and you're looking for a solution, please use the forum. Comments might not be answered.