PHP Introduction - TOP10

PHP Introduction

1. What is PHP? PHP stands for Hypertext Preprocessor and is a server-side language. This means that when a visitor opens the page, the server processes the PHP commands and then sends the results to the visitor's browser.
2. How PHP Works? When a user navigates in their browser to a page that ends with a .php extension, the request is sent to a web server, which directs the request to the PHP interpreter.
3. What can PHP do?  Allow creation of shopping carts for e-commerce websites.  Allow creation of CMS (Content Management System) websites.  Allow creation of Forum websites.  Allow creation of User Management System websites.  Open up thousands of possibilities for online tools.
4. Basic PHP Syntax PHP code must be contained in special tags so that the PHP interpreter can identify it. Depending on the PHP configuration, these tags can take several forms:  - Standard Tags This is the most commonly used (and recommended) form. <?php   PHP CODE GOES IN HERE ?> - HTML or Script style tags <script language="php">  PHP CODE GOES IN HERE </script> - Short  tags <?    PHP CODE GOES HERE ?>

5. Installation
Following things are required for using php on windows - Apache Server or IIS Server - Mysql - PHP
WampServer is a Windows web development environment. With this we can create web applications with Apache, PHP and the MySQL database. Even PHPMyAdmin is provided to manage your databases.
After you installed WampServer on Windows complete and then how to create and execute or run your php file on windows?
First START WampServer by clicking your START MENU and then selecting WampServer and then click start WampServer.
Once Server is started then you will see a WampServer icon in the right corner of your taskbar where your clock is present.
Now open the drive where you installed your wampserver.(ex. C:/wamp/) Then open the www folder. (ex. C:/wamp/www/) This is your Base directory, your all projects will come here.
Now create a directory here named mytest. Now open notepad or any other text editor you have. Type the following in it. <?php    phpinfo();   ?>  Save the file to the directory mytest as index.php  
Now click on the icon present in the right hand side of your taskbar and then click on localhost Now you will see the list of projects, then click on mytest, you can see that your program is executed. It will show you all the details of the php version you have installed.

6. PHP Statements and Whitespace
PHP statements must be inside of PHP tags to be processed by the PHP interpreter. Each PHP statement must end with a semi-colon, which tells the PHP interpreter that the statement is complete. If a semi-colon does not appear at the end of a line, the interpreter will assume that the statement continues onto the next line.
The PHP interpreter condenses all sequential whitespace in PHP scripts to a single whitespace. This convenient feature allows PHP developers to structure their code in a readable format without being concerned about the effects of line breaks and tabs.

PHP has two forms of comments:     - Single-line comments begin with a double slash (//) or sharp (#).

Next Post »