PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly
PHP stands for PHP: Hypertext Preprocessor. This confuses many people because the first word of the acronym is the acronym. This type of acronym is called a recursive acronym
There are a couple of articles written on this by the authors of PHP.Click here to read
about them
Here's a list of some of the more important new features we think are
relevant.
To have your pages processed by the PHP script engine your pages must end in either .php or .php3 extensions. We have set up our servers in such a way that all files with the above extensions are not handled by the Webserver and are sent to PHP.
Hello WorldThe code below must be entered in notepad or a simple text editor and saved with a .php extension. All the below code does is display, "Hello World"
<html><head><title>PHP Test</title></head> |
The point of the example is to show the special PHP tag format. In this example we used <?php to indicate the start of the PHP tag. I then put in the PHP statement and then closed the tag. You may jump in and out of PHP mode in an HTML file like this all you want. The colours you see are just a visual aid to make it easier to see the PHP tags and the different parts of a PHP expression.
To view the above code compiled click here
Checking Your Browser TypeThe code below will check what sort of browser the person viewing the page is using. In order to do that we check the user agent string that the browser sends as part of its request. This information is stored in a variable. Variables in PHP always start with a dollar-sign in PHP. The variable we are interested in is $HTTP_USER_AGENT. To display this variable we can simply do:
<?php echo $HTTP_USER_AGENT; ?> |
There are many variables in PHP that are automatically set by us. To get a list of these variables use the following code below. Some programs may require certain variables be set/enabled to certain values. You may need to contact support to set these. Insert the code below to get a list of the current variables set on your webserver.
<?php phpinfo(); ?> |
Note that although each server has the same standard installation applied to it, from time to time we make changes for clients, therefore do not assume if you have multiple accounts with us that each installation is identical. In most cases it will be but please note.