php

Monday,November,26th,2012by Jhalak Subedi

PHP stands for Hypertext Preprocessor. It is an open source server side scripting language normally embedded inside HTML context. By server side we mean that in order to work with PHP we must install a server like apache web server.The PHP code is not sent directly to the client like HTML or JAVASCRIPT but instead the interpreter installed inside the server parses the PHP code and converts into compatible HTML.

PHP doesn’t cost anything . It is available free from php.net for commercial use or whatever.PHP alongwith MySQL database and APACHE server provides a comprehensive way of developing the web applications.Now PHP supports myriad number of databases and servers.Lots of tools and frameworks that are alive today utilizes the power of PHP.

How to install PHP
For learning purpose we need to install a PHP package which includes everything -the server and the database.
It depends on what machine you are using. If you are on WINDOWS then there’s a package called WAMP which includes everything mentioned above.On LINUX you can use LAMP(LINUX APACHE MySQL PHP) and on MAC there’s MAMP(MAC APACHE MySQL PHP) for you. After successful installation your local machine behaves like a server and you can run PHP commands.

PHP “Hello World!!”

1) Open your favorite text editor and type in the following code:

<?php
echo "Hello world";
?>

2) And save it as index.php by creating a folder inside the root folder. If you are using WAMP then navigate to WWW directory (c:\wamp\www\myfolder\)
3) Then type the URL inside the browser input field like(localhost/myfolder/index.php) and it will give you the desired outpt which is printing hello world to the screen.

Code Explaination
Well its the very basic script,nothing complicated here. First line of code says the beginning of the PHP script and the echo command used in the second line is for printing any text to the screen. The code in the second line is actually a statement so it is terminated by a semicolon.The text is wrapped inside quotes to mark that it is a string and remember that you could also use the single quote. The last line of code simply ends the php section.


One Response to “php”

  1. Youre so cool! I dont suppose Ive read something like this before. So nice to search out any person with some authentic ideas on this subject. realy thank you for starting this up. this website is something that is wanted on the internet, someone with slightly originality. useful job for bringing something new to the internet!

Leave a Reply

Sidebar