What is PHP?

The script language PHP (originally known as Personal Home Page, but now known as PHP: Hypertext Preprocessor) offers you many possibilities to make dynamic web content available on your website. PHP can easily handle a variety of databases, file and directory systems, and is also suitable for complex web applications. For IONOS Linux Webhosting contracts and IONOS Managed Servers, PHP is installed in different versions.

Functionality of PHP

  • Creating and manipulating GIF, JPG and PNG files and using TrueType fonts

  • Database functions for integrating MySQL databases

  • Extended network functionality

  • Regular expressions

  • Supports XML/XSLT

  • Encryption (MD5, Base64) and more advanced encryption algorithms (such as AES) through mcrypt

  • Advanced calendar functions

Sample Script: "What is the date today?"

You can include PHP code in an HTML page, although the file has to be renamed with the extension .php, instead of .html.

<html>
<head>
<title>First PHP script</title>
</head>
<body>
<?php
echo "What is the date today? ";
echo "Today is ".date("d.m.Y");
?>
</body>
</html>

Click here to see the output of the script.

Sample Script: Reading Form Data

The following example shows a form that uses variables. PHP is often used to create dynamic content, such as forms.

<html>
<head>
<title>PHP and Forms</title>
</head>
<body>
<?php
if (isset($_POST['eis'])) {
echo "Your favourite ice cream is <b>".$_POST['eis']."</b>";
exit;
}
?>
<form action="<? echo basename($PHP_SELF); ?>" method="post">
What is your favourite ice cream?: <input type="text" name="eis" size="30" maxlength="30">
<input type="submit" value="OK">
<input type="reset" value="Reset">
</form>
</body>
</html>

Click here to see the output of the script.