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 :
- WinSyntax text editor its freeware by Arisesoft and has code syntex highlight feature.
- UniServer v5.3 its freeware by UniformServer and is required to run PHP on windows machine.
Lets start our First PHP code
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
8. print “Love All” ; // this is comments
10. // PRINT and ECHO just output the quoted phrase
11. /* every line statement ends with semicolon ;*/
13. echo “<br>and let live” ; /* this is also comment ” I like this style 🙂 “ */
above code will output two lines of text to your browser
and let live
Why two lines? because we have included <br> brake line HTML tags within quotes at line number 13