Php Tutorial 2 – Hello World Program

Welcome back to the tutorial 2, here we will start our programming in php. We will make different folders for different tutorials, so first make a Tutorial 2 folder in www directory. We will do our programming in notepad or for your use you may use different user friendly text editors like notepad ++. Php files have .php extension, index.php is the file which is automatically executed in a folder, so make a index.php in Tutorial 2 folder and type the below code in .

In a php file we can add HTML, CSS, JAVASCRIPT or anyother language so we have php tags which tell the server that the lines inside these tags are php codes, opening tag for php is <?php and closing tag is ?>







now lets code for a simple hello world program.



<title>Innovation Escalator Tutorial</title>




echo “Hello World”;




echo command is used for printing, and each and every statement is terminated by a use of a semicolon.

Use of variables, loop and if conditions in php:




if($i%2 == 0)

echo “Hello<br>”;



the above php code prints hello only when the value of variable i is even. In php we just use a $ sign before a variable moreover we don’t need to define the variable type its up to you what data type you want to store, its a kind of flexibility.

This is all about basic of php… wait for next. Till then if you have any queries you make post them.


Php Tutorial 1 – Setting up localhost

Hi everyone I’m starting with the tutorials of php here in a series, hope it help you guys, stay updates for a series of php tutorials.

As you know php is a server side scripting language, it is mainly used to develop websites and web-applications. Since it is a server side scripting language you need a server to run your php files, for this there are two options i.e either you get your web hosting account or setup your own server. I find setting up your server is a better option so here I will  tell you how to install it, I use WAMP server which automatically configures php, mysql, apache and phpmyadmin. Just click on the link below to download wamp server:

download 32bit version or 64bit according to your requirement.

After installing you will get a shortcut on your desktop, start it by double clicking it you will get a wamp icon in your taskbar.

Click on that icon to get menu…

Wamp menu

>localhost – it will open the address of localhost in your web browser.

>phpmyadmin – this is a installed alias which will help you manage your databases.

>www directory – this is the directory where you will place you php files/projects to run.

>apache – manages apache extensions.

>php – manages php extensions.

>mysql – manages mysql extensions.


That was all about installing wamp server i.e setting up a localhost.

Next post will we a very simple post just telling you about a hello world program in php… till then install php… :)

Apps on

Hello everyone I’m here to discuss about how to build a Facebook App. Facebook has millions of user with it and developing an app on Facebook gets you opportunity to deeply integrate into the core Facebook experience. An app developed on Facebook can integrate with many aspects of, including the News Feed and Notifications. Apps on Facebook are the web apps that are loaded in context of Facebook. And a web app can we developed by any of the available languages, the further Blog is based on php.

The apps on facebook are canvas based, we have a canvas (or iframe) in which we load our app.
Suppose the url to your app is then the app url will be (i.e. this url will load the contents of your original app link).Before getting into anything lets know the size of canvas so that we can build our app efficiently.  
760px (width) – if you build your app on a full app page, and
520px (width) – if you embed your app on a page in

Facebook Integration

Firstly you need to goto Developer App click on Set Up a New App, further you will be asked to enter the name of your app, do it and proceed, cross the security checks and all and doing all that you will be redirected to a page where you need to enter the basic information about your app and this page will also contain the tab Facebook Integration. Under this tab you will get your app_id and app_secret, you need to note these two because they will be used further in your app. Your canvas url gets integrated to facebook now what you need to do is start developing your app.

I can’t give you an idea of what an app to develop, so am just proceeding with how to use the facebook pre-defined functions in your app and access the user information. You need a facebook.php, which contains all the required pre-defined functions to be used. A sample code to use these functions and access user information on Facebook is –


// Awesome Facebook Application ( ‘facebook.php’;
// Create our Application instance.$facebook = new Facebook(array(  ‘appId’ => ‘your_app_id‘,  ‘secret’ => ‘your_app_secret‘,  ‘cookie’ => true,));
    $app_id = “your_app_id”;    $app_secret = ‘your_app_secret’;    $canvas_page = “your_canvas_url”;    $auth_url = “” . $app_id . “&redirect_uri=” . urlencode($canvas_page);    $code = $_REQUEST["code"];    $token_url = “”.$app_id.”&redirect_uri=”. urlencode($canvas_page).”&client_secret=”.$app_secret.”&code=”.$code;       if (empty($code)) {echo(“<script> top.location.href=’” . $auth_url . “‘</script>”);}        $access_token = file_get_contents($token_url);        $user_data_url = “”.$access_token;        $user = json_decode(file_get_contents($user_data_url));
echo(“Username:” . $user->name);
echo(“Email” . $user->email);

The above code will fetch user-name on and his email-id, you can use this code for your app and further modify it, there are multiple ways to do it but i find it the simplest. This would be the starting or basic step of your Facebook app use this and get a burning idea for your app and show your programming skills and get your app working on

Hope your find it useful… hope to see your app soon… :)