Learn PHP : Lesson 1 – Get it Easy

Ok you wanna learn PHP. Who knows you might be running next big thing. What ever! lets start first lesson. Your first code in PHP scripting language. I would advise you to learn a bit of HTML before you jump into PHP coding thing.

Like HTML, PHP also lives in tags known as open and close tags. <? is the open or start tags and ?> is close tags. Every PHP code stats with open tags and ends with close tags. In PHP 5 version coders are more inclined to use <?php open tags rather than <?

There are some really simple script commands in PHP like PRINT, ECHO, SET, GET, POST, FOR, WHILE etc. Just like ordering someone to do a certain job for you. Yeah! just like that. ๐Ÿ™‚

Before you begin coding PHP you need to download a few Freeware softwares from net

These are :

  1. WinSyntax text editor its freeware by Arisesoft and has code syntex highlight feature.
  2. UniServer v5.3 its freeware by UniformServer and is required to run PHP on windows machine.

Lets start our First PHP code

1. <?php
2. //
3. // double forward slashes indicates ignore command to PHP engine
4. // and hence are used for writing comments into script
5. // Param Lowe wrote this code on 21st Oct, 2009 at 11:15 AM IST
6. //
7.
8. print “Love All” ; // this is comments
9.
10. // PRINT and ECHO just output the quoted phrase
11. /* every line statement ends with semicolon ;*/
12.
13. echo “<br>and let live” ; /* this is also comment ” I like this style ๐Ÿ™‚ “ */
14. ?>

above code will output two lines of text to your browser

Love All
and let live

Why two lines? because we have included <br> brake line HTML tags within quotes at line number 13

Leave a Reply

Your email address will not be published. Required fields are marked *

*