Wednesday, March 17, 2010

Printing a variable (Array element)

<?phpecho $_SERVER['HTTP_USER_AGENT'];?>
 
There are many types of variables available in PHP. In the above example we printed an Array element. Arrays can be very useful.
$_SERVER is just one variable that PHP automatically makes available to you. A list can be seen in the Reserved Variables section of the manual or you can get a complete list of them by looking at the output of the phpinfo() function used in the example in the previous section.