Tuesday, April 30, 2013

HELLO WORLD IN "PHP"


PHP stand for Hypertext Preprocessor a group of people call it "Personal Home Page". It is server side scripting language,i.e. browser can't run a PHP code directly. It require a server before it goes to browser. PHP follow OOPs (object oriented programming like C++).PHP is used to create dynamic web pages.A dynamic web pages are those which can interact with the visitor.You can use HTML with PHP.
To run a PHP code you will need:

1. A code Editor (notepad,notepad++ etc)
2. A server with PHP (wamp,xamp,easyphp come with all the package i.e php,apache,mysql,phpmyadmin etc)
Extension Of a PHP code is .php

here it is helloworld.php

<?php
 echo("hello world");
?>

that's it..
ya that's it..
Now paste this code in C:\wamp\www for wamp and in htdocs for xamp and run the server .
Open browser , type localhost and you'll find your file there,just open it.

Explaining the code :
A PHP code start with <?php , note there is no space  and end end with ?>  echo("string"); work the same as  "printf " in C and "cout" in c++ does.

No comments:

Post a Comment