Showing posts with label Introduction to PHP. Show all posts
Showing posts with label Introduction to PHP. Show all posts

Friday, 25 November 2011

Introduction to PHP

  • PHP stands for hypertext preprocessor or personal home page. Php is a server side scripting language, which can be embedded into an html page or used as a stand alone.
  • Php supports many database like mysql, Informix, oracle, Sybase, postgresql, odbc etc..
  • Php is an open source software (oss). Php is free to download and use language.
  • Php file may contain text, html text, and script.
  • Php file have a file extension .php, .php3, .phtml.
  • Php  runs on different platform like window, linux, unix, mac etc. php is compatible with almost all server used today like apache, IIS.

Ø       Basic php syntax

A php scripting block always start with <?php and ends with ?>. a php scripting block can be placed anywhere in the document.

Syntax
<?php
                    Some code
?>

On server with shorthand support enabled you can start a scripting with <?php and ends with ?>, However for maximum compatibility we recommend that you use the standard form rather than the shorthand form.

A php file normally contain <html> tags just like an html file and some php scripting code.

Example

<html>
     <body>
              <?php 
                        echo “Hello World”;
              ?>
     </body>
</html>             

OR

<?php
     echo “Hello World”;
?>

  • Each code line in php must end with a semicolon(;).       
  • There are two basic statement to output text with php are echo and print.
  • In the example above we have used the echo statement to output the text “Hello World”.

Ø       Comment in php

In php we use  // single line to make a single line comment or /*…….*/ to make large comment block.

Ø    PHP is Case Sensitive


                PHP is case sensitive – therefore  which your capitalization closely when you cerate or call variables, objects and functions. For example variable $A and $a both are different.

Posted By : Hemangi Zala