In this tutorial, I will walk through the most popular examples to learn PhP. The topics includes simple php example, php get and post methods, php arrays, and php object.
PhP hello word
1 2 3 4 5 6 7 8 |
<html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body> </html> |
Here the echo keyword is used to print out the html string on your browser.
Get system information from PHP
<?php phpinfo(); ?>
Get Client’s browser information
1 2 3 |
<?php echo $_SERVER['HTTP_USER_AGENT']; ?> |
$_SERVER is a special reserved PHP variable that contains all web server information. It is known as a superglobal.
A possible output might be:
Mozilla/4.0 (compatible; MSIE 6.0;
[Read More...]