Members Login
Register

PHP Operators
PHP Strings / Functions


PHP Reference

PHP Date
Web Application Development PHP Introduction

PHP (officially know as PHP: Hypertext Pre-processor) is a widely used general purpose scripting language. It is especially suited for Web development to help make database driven websites and can be embedded into HTML or XHTML. It can also be used in conjunction with JavaScript.

PHP was originally designed for web development to produce dynamic web pages. Used in conjunction with MySQL you can bring your website to life. Shopping cart scripts, forums and many more can all be coded using PHP.

If you are new to PHP then you are in the right place. We will be offering tutorials on creating your PHP scripts as well as code snippets of how to embed the different functions PHP offers.

Help can be found on using PHP in our forums.

PHP is a server side scripting language. This often written in with XHTML pages. PHP is not sent directly to the client by the server instead it is processed by the PHP engine and executed before being passed to the client.

Getting started with PHP is simple, now that you have got your hosting account and confirmed that you have PHP enabled on your hosting account we can check to see which version of php you are running. The code below will allow you to display the PHP information. This is only a snippet of the information I couldn't display it all here as its rather a big page full.

Code to display PHP information.


<?php
phpinfo();
?>


Once you have executed this code you should now be displayed with a page something like this.

php info image

When writing PHP you need to tell the PHP script engine that the code is PHP. All pages that contain PHP code must be named accordingly like so, index.php as apposed to index.htm or index.html I try always use the .php extension now as you never know when you may want to add PHP code to your page. Renaming these pages after can course problems, all your navigation menu has to be altered and websites linking to your pages will no longer have the correct page. So in my opinion you should use the .php extension when naming your pages from the start.

Now that you have your page named and want to input some PHP code on your page you have to enclose the code in special PHP tags. These tags are.

PHP start and end tags
<?php opening tag
?> closing tag


PHP can be combined within your HTML pages as long as the page is named with the .php extension. Here is a simple page that combines HTML and PHP within the same page. I have used the PHP echo feature to output the message to the screen.



<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>
Combine PHP and HTML</title>
</head>
<body>

<?php
echo "Hello World";
?>

</body>
</html>


//Adding comments to your PHP code can be done just as you can with HTML but the comment tags are different.

// This is a one line comment

/*
This is a PHP block of
Comments which can span across
Multiple lines
*/


































Copyright © 2008 - 2010 Web Application Development
Web Design by www.webreger.com
Valid XHTML 1.0 Transitional Valid CSS!