Thursday 10 December 2015

Introduction to PHP

PHP
  • PHP stands for PHP: Hypertext Preprocessor
  • PHP is a widely-used, open source scripting language
  • PHP scripts are executed on the server
  • PHP is free to download and use
  • PHP is a server side scripting language used to developed attractive and dynamic web pages.
  • PHP is a powerful tool for making dynamic and interactive Web pages.
  • PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP(.NET)

PHP History

     PHP was originally created by a developer named Rasmus Lerdorf.

Advantages Of PHP


  •  Performance:- Scripts written in PHP executes faster than those written in other scripting language.
  • Open Source Software(oss):- PHP’s source codes are freely available on the web.
  • it may used without paying any licensing fees, free download all versions.
  • Platform independent:- PHP is available for Linux, Microsoft Windows, Mac Operating System. PHP programs are portable between platforms.
  • As a result PHP application developed on Windows will run on other Operating system without any significant issues.
  • database support:- Support almost all database like Oracle,MySQL, sql server etc.
  • Web server supports(wide range):- Support all web servers like Apache tomcat , IIS etc.
  • OOPs support:- PHP Supports object oriented programming system concept.
  • Run on low configuration:-PHP scripts can execute on low configuration machine(system’s configuration minimum).
  • Light weight software:-PHP’s software is light weighted it means maximum cover 20-30mb and install all the related software.
  • HTML script is embedded/associated with PHP script
  • Easy to developed and easy to understand.

PHP installation 
  • The PHP Group provides a Compaq software solution under The GNU (General Public License).
  • It automatically configure according to different operating system.

There are four types of PHP Compaq software.
    WAMP
—  LAMP
—  XAMPP
—  MAMP

PHP Syntax
How to Start and End Php Code
syntax is a way to representation of PHP script.
Basically it gives the primary idea to specify the code format.
It also specify the area of a written code.
There are three ways to start PHP environment.
The most commonly and effective  PHP  syntax
Short or short-open tag
HTML script tags

The most commonly and effective  PHP  syntax
<?php
  echo "welcome to the world of php";
  ?>
In the given Example:
It begin with (< ?php) and End with(? >).
echo statement is used to print the given string.
Mandatory closing in(“ABCD”)double quotes.
Terminate the script with semicolon because semicolon is known as terminator.

Short or short-open tags look like this
<?
  echo "welcome to the world of php";
  ?>
 
In the given above example:
We use Short tags. start and end with () respectively.
Declare the statement in between (), to display the output on browser
short open tags smoothly works on XAMPP server but Face problem on wamp server
if you are using  WAMP Server First you have to Set the short_open_tag setting in your php.ini file to on

HTML script tags
<script language="PHP">
  echo "welcome to the world of php";
</script>
HTML script is also declare to start PHP environment.