Writing your first PHP script

You already knew how to set up PHP environment in personal computer. I hope you set all require software to run PHP code. If you do not set up PHP environment in your pc, I suggest you at first set up PHP environment in your pc. In our whole tutorial we use vertrigo web server and dreamweaver editor. 

Step to write first PHP code

At first run your server by double clicking on vertrigo server icon. Now you have to go to the server folder where you installed it. Then click on VertrigoServ folder and click on www folder. If you use ZAMP, click on htdocs folder. This is the place where you will keep your PHP code. Open a file helloworld with .php extension. Now your PHP file name is helloworld.php. It is required to add .php extension in each PHP file otherwise it will not work.   
Open the PHP file using Notepad or Dreamweaver and write the following code.

<?php
echo ”Hello Everyone, This Is My First PHP Code”;
?>

Save the code. Now it is time to see your first PHP code. Open your browser and write http://localhost/helloworld. It shows Hello Everyone, This Is My First PHP Code. In this code <?php is the php opening tag and ?> is the end tag. So we write our code within this tag. echo is a PHP built in function. We use this function to print php code.  


Comments

Popular posts from this blog

How to construct a B+ tree with example

How to show only month and year fields in android Date-picker?

Visitor Counter Script Using PHP