Thursday, 30 August 2012

Episode 1: Overview of PHP Structure and Syntax


 PHP programs are written using a text editor, such as Notepad or WordPad, just like HTML pages. Unlike HTML, though, PHP pages, for the most part, end in a .php extension. This extension signifies to the server that it needs to parse the PHP code before sending the resulting HTML code to the viewer’s Web browser

The Rules of PHP Syntax

One of the benefits of using PHP is that it is relatively simple and straightforward. As with any computer language, there is usually more than one way to perform the same function. Once you feel comfortable writing some PHP programs, you can research shortcuts to make your code more efficient. For the sake of simplicity, we cover only the most common uses, rules, and functions of PHP. You should always keep in mind these two basic rules of PHP:
 PHP is denoted in the page with opening and closing tags, as follows:
<?php
?>

 PHP lines end with a semicolon, generally speaking:
<?php
// First line of code goes here;
// Second line of code goes here;
// Third line of code goes here;
?>

You can add comments in your program, as in the preceding code, through double slashes (//) for oneliners or /* and */ for opening and closing comment tags that may extend over several lines of code.


Written by “Shojib”.

No comments:

Post a Comment