how to write first php program



Last updated on November 23rd, 2015 at 08:44 am

how to write first php program

Now I had installed all I need to write php scripts or files but how do I write one. First of all I created a learning folder on my desktop where I intended to keep all my files I made during my learning process. So now I am going to make my first ever PHP file called hello.php

So as a starting point I decided to go along with a starting ” Hello World! ” program in PHP.

For this I simply opened my notepad and then save it as
saving-file-as-php

 

 

 

 

 

 

Now since I had created my first PHP file I am foing to write my first PHP script right there in notepad.
So I typed

and hit save button. Now we know that PHP file can not be opend by a browser. So to see the response of my code I start running my easy php dev server by clicking its icon on mt desktop. After it gets started it looks like a black red icon under startup program  as shown in this figure

icon

Now once it is started right click this

icon2

and select local web to start local web. Right now I am learning PHP so I had not configured anything on my easy php dev server. Once started in your browser it looks like

easy1

Here you can click home icon and now your screen looks like this

 

Now here you can see I have created alias “learn” for my folder where I will put all my learning and testing files.
Here you can also see a code test window. You can go ahead and test your simple “hello world” script right here in code tester and it would look like

Alternatively click alias “learn” ,as in my case you can create with any name , now you will see a screen like this

 

Here click file “hello.php” Now you get your interpreted result in your web browser.

This is how I write and interpreted my first script in PHP. I am not an expert so what you see here is through an point of view of novice and how I teaches myself. Maybe one day if I continue to learn I would become a PHP guru. Who knows?


Leave a Reply