Requierments to run PHP 1. It is serverside scripting language so probabbly We need follwing severs. Apache PHP XAMMP MySql Software Perl So if weinstall Xampp everything will be installed . 2.Any Editor to write coding like notepad. 3.Browser to to view the output of program.
SYNTAX <? php type coding here ?> Example: <? php echo Hi ?>
LOOP TYPES 1. if else 2. for loop 3.for each 4. while loop 5.do while loop 6.break 7.continue Syntax and codings similar to C language.
Arrays and Strings Array is data structuer that stores one or more Similar types of variables in single name. * Numeric array - An array with a numeric index * Associative array - An array where each ID key is associated with a value * Multidimensional array - An array containing one or more arrays
Strings String is sequences of character EX: $string_1 = "This is a string in double quotes"; There are more number of function. For functions refer: http://www.w3schools.com/php/php_ref_string.asp
FILE INCLSION 1. include(): The include() function takes all the text in a specified file and copies it into the file that uses the include function Ex: menu.php file contains <? php home-> user1->user2 ?> X.Php include th menu.php file using following coding <?php include("menu.php"); ?> OUTPUT OF X.php: home->user1->user2
FILE INCLUSION requier()-The require() function takes all the text in a specified file and copies it into the file that uses the include function EX : if we want to use x.php file which already include the menu.php file <?php require("x.php"); ?>
GET &POST METHODS GET: It sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? Character . Ex: output contains the submitted page information. <form action="welcome.php" method="get"> Name: <input type="text" name="fname" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> OUTPUT: http://www.w3schools.com/welcome.php? fname=Peter&age=37
POST METHOD Using the GET method is restricted to send upto 1024 characters only but if we want to send more then 1024 char we will go forthe POST method does not have any restriction on data size to be sent. Ex: <form action="welcome.php" method="post"> Name: <input type="text" name="fname" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> OUTPUT: The url does not store vaue but the page retrive the value http://www.w3schools.com/welcome.php