Showing posts with label PHP Tutorial. Show all posts
Showing posts with label PHP Tutorial. Show all posts

Saturday, 15 December 2012

PHP POST Function

The $_POST Function

This function is used to collect data from html forms sent with post method. Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. This post method is more security compare get method. Below simple program will explain this breifly.

Example:
<form action="view.php" method="post">
Article: <input type="text" name="article" />
Price: <input type="text" name="price" />
<input type="submit" />
</form>

When the user clicks the "Submit" button, the form values will be sent to server. but the senting values cant view with URL.When you click the submit button the URL will be look like this

http://www.u3schools.com/view.php

Now you can use $_GET function on view.php page and get the form values. Form fields will automatically be the keys in the $_GET array.

Article name  <?php echo $_POST["article"]; ?>.<br />
Article price <?php echo $_POST["price"]; ?> INR(Indian rupees)

The output of above code:
Article name  Nokia1200
Article price 1540 INR(Indian rupees)

Advantage of post method:
=> The POST method is invisible to others
=> It has no limits on the amount of information to send.

PHP GET Function

The $_GET Function

The built-in $_GET function is used to collect values from a form sent with method="get". Information sent from a form with the GET method is visible to everyone and has limits on the amount of information to send (max. 100 characters). The values will be displayed in the browser's address bar. Below simple program will explain this breifly.

Example:
<form action="view.php" method="get">
Article: <input type="text" name="article" />
Price: <input type="text" name="price" />
<input type="submit" />
</form>

When the user clicks the "Submit" button, the form values will be sent to server through URL. When you click the submit button the URL will be look like this

http://www.u3schools.com/view.php?article=Nokia1200&price=1540

Now you can use $_GET function on view.php page and get the form values. Form fields will automatically be the keys in the $_GET array.

Article name  <?php echo $_GET["article"]; ?>.<br /&gt
Article price <?php echo $_GET["price"]; ?> INR(Indian rupees)

The output is look like this:
Article name  Nokia1200
Article price 1540 INR(Indian rupees)

PHP Functions

PHP Functions

A function is just a name we give to a block of code that can be executed whenever we need it. This might not seem like that big of an idea, but believe me, when you understand and use functions you will be able to save a ton of time and write code that is much more readable!

Simple PHP Function
function functionName() {
    execution code;
}

Note: Your function name can start with a letter or underscore "_", but not a number! A simple PHP function that writes Price of the article

<html>
<body>

<?php
function getPrice()
{
echo "TWO HUNDRED and TWENTY ";
}

echo "Article price is";
getPrice();
?>

</body>
</html>

Above code output is given below
Article price is  TWO HUNDRED and TWENTY

Passing parameters inside PHP Functions

Another useful thing about functions is that you can send them information that the function can then use. Look at the below example,

<?php
function print_it_out($first_part,$second_part,$third_part){
    echo "$first_part $second_part $third_part";
}
$part1 = "Welcome";
$part2 = "to the";
$part3 = "u3schools";
print_it_out($part1,$part2,$part3);

$part4 = "This";
$part5 = "is";
$part6 = "online web tutorial";
print_it_out($part4,$part5,$part6);
?>

The above example will describe clearly that how to use parameters inside php functions. we are using the same function in two different places with different parameters in our program. Here the function work is bind the three parameters and print onthe screen. The aim of the function is to simplify the developers work. Note:Parameters is nothing but an arguments.

Return values from PHP Functions

Sometimes you may want to call a function and have a value returned back to the main coding area. This is done using the return command.

<?php
function addit($first_number,$second_number){
    $total_sum = $first_number + $second_number;
    return $total_sum;
}
$first_number = "3";
$second_number ="2";
$total = addit($first_number,$second_number);
echo "$total";
?>

The output of the above program is:
5

Leaving the return command out, the result would be blank. In the above example, the variable $total calls the function entering two arguments. The function takes the numbers and finds the sum. The sum value is "returned" back to the calling variable $total.

Foreach Loop in PHP

Foreach Loop in PHP

PHP 4 introduced a foreach construct, much like Perl and some other languages. This simply gives an easyway to iterate over arrays. foreach works only on arrays, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes; the second is a minor but useful extension of the first:

Foreach loop Syntax:
foreach (array_expression as $value)
statement
foreach (array_expression as $key => $value)
statement

The first form loops over the array given by array_expression. On each loop, the value of the current element is assigned to $value and the internal array pointer is advanced by one (so on the next loop, you'll be looking at the next element).

The second form does the same thing, except that the current element's key will be assigned to the variable $key on each loop.

As of PHP 5, it is possible to iterate objects too. As of PHP 5, you can easily modify array's elements by preceding $value with &. This will assign reference instead of copying the value.

Example 1:
<?php
        $browsers = array ("Firefox", "Internet Explorer", "Opera");
        echo "<select>";
        foreach($browsers as $browser)
        {
                echo "<option name='$browser'>$browser</option>";
        }
        echo "</select>";
?>

Example 2:
Once you understand that concept you can then use the FOREACH loop to do more practical things. Let's say an array contains the ages of 5 family members. Then we will make a FOREACH loop that will determine how much it costs for each of them to eat on a buffet that has varied prices based on age. We will use the following pricing system: Under 5 is free, 5-12 years costs $4 and over 12 years is $6.

<?php
$t = 0;
$age = array(33, 35, 13, 8, 4);
foreach ($age as $a)
 {
 if ($a < 5)
  {$p = 0;}
 else
  {
  if ($a <12)
   {$p = 4;}
  else
   {$p = 6;}
  }
$t = $t  + $p;
print "$" . $p . "<br>";
 }
print "The total is: $" . $t;  
?>

For loop in PHP

For loop in PHP

for loops are the most complex loops in PHP. They behave like their Java and C Language counterparts. The syntax of a For Loop is given below.

For loop Syntax:
for (expr1; expr2; expr3)
statement

The first expression (expr1) is evaluated (executed) once unconditionally at the beginning of the loop. In the beginning of each iteration, expr2 is evaluated. If it evaluates to TRUE, the loop continues and the nested statement(s) are executed. If it evaluates to FALSE, the execution of the loop ends. At the end of each iteration, expr3 is evaluated (executed).

The simple program that prints 0 to 9 numeric values on the screen one by one using php for loop. The sample code will be given below.

<body >
Print 0 to 9 numeric values use for loop<br>
<?php
for ($count = 0; $count < 10; $count = $count + 1) {
echo $count.'<br>';
}
?>
</body>

PHP While Loop

While loop in PHP

While loops are the simplest type of loop in PHP. They behave just like their Java and C Language counterparts. The basic form of a while statement is:

while (expr)
statement

The meaning of a while statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration (each time PHP runs the statements in the loop is one iteration).

Sometimes, if the while expression evaluates to FALSE from the very beginning, the nested statement(s) won't even be run once. Like with the if statement, you can group multiple statements within the same while loop by surrounding a group of statements with curly braces, or by using the alternate syntax:

while (expr):
statement
...
endwhile;

Example:
$article_price = 5;
$quantity = 10;

echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Quantity</th>";
echo "<th>Article Price</th></tr>";
while ( $counter <= 100 ) {
        echo "<tr><td>";
        echo $counter;
        echo "</td><td>";
        echo $brush_price * $counter;
        echo "</td></tr>";
        $counter = $counter + 10;
}
echo "</table>";

do-While

do-while loops are very similar to while loops, except the truth expression is checked at the end of each iteration instead of in the beginning. The main difference from regular while loops is that the first iteration of a do-while loop is guaranteed to run (the truth expression is only checked at the end of the iteration), whereas it's may not necessarily run with a regular while loop (the truth expression is checked at the beginning of each iteration, if it evaluates to FALSE right from the beginning, the loop execution would end immediately). We given below a Simple program that explain clearly do-while loop.

<html>
<body> 
<?php
$i=1;
do
  {
  $i++;
  echo "The value is " . $i . "<br />";
  }
while ($i<=10);
?>

Arrays in PHP

Arrays in PHP

In this tutorial we will explain you how to work with arrays in php. You will learn how to create, sort or print an array. Besides this we will touch on multidimensional arrays as well.

Arrays are special data types. Despite of other normal variables an array can store more than one value. Let's suppose you want to store basic colors in your PHP script. You can construct a small list from them like this:

Color list:
* red
* green
* blue
* white

It is quite hard, boring, and bad idea to store each color in a separate variable. It would be very nice to have the above representation almost as it is in PHP. And here comes array into play.

The array type exists exactly for such purposes. So let's see how to create an array to store our color list. There are more ways to create an array in PHP. Maybe the most easiest way to create our color list array is the following:

$color_array[0] = "red";
$color_array[1] = "green";
$color_array[2] = "blue";
$color_array[3] = "white";
or
$color_array = array("red","green","blue","white",);

Numerically Indexed Array

Numerically Indexed Array is nothing but the array elements identified by the numeric value.like this below example

$color_array[0] = "red";
$color_array[1] = "green";
$color_array[2] = "blue";
$color_array[3] = "white";

Associative Arrays

Associative Array is nothing but the array elements identifieds by their element associative string. Look at the below example:

$basevalues["binary"] = 2;
$basevalues["octal"] = 8;
$basevalues["decimal"] = 10;
$basevalues["hexa_decimal"] = 16;
echo "Base value of binary - " . $basevalues["binary"] . "<br />";
echo "Base value of octal - " . $basevalues["octal"] . "<br />";
echo "Base value of decimal - " . $basevalues["decimal"] . "<br />";
echo "Base value of hexa decimal - " . $basevalues["hexa_decimal"];

output of above program
Base value of binary - 2
Base value of octal - 8
Base value of decimal - 10
Base value of hexa decimal - 16

PHP Switch Case Statement

Switch statement

Switch statements work the same as if statements. However the difference is that they can check for multiple values. Of course you do the same with multiple if..else statements, but this is not always the best approach.

A switch statement allows a program to evaluate an expression and attempt to match the expression's value to a case label. If a match is found, the program executes the associated statement. The syntax for the switch statement as follows:

switch (expression) {
    case label_1:
        statement_1
        [break;]
    case label_2:
        statement_2
        [break;]
    .
    .
    .
    case label_n:
        statement_n
        [break;]
    default:
        statement_default
        [break;]
}

examples switch case:

A simple switch case program in php that match out the input creature name with given creatures names. If it match, it will produce the string and print by echo function. If the input creature name cant match, the default case will be run and print "I have not heard of this creature" like this.

<?php
// switch example using strings
$creature="u3schools";

switch ($creature){

case "google":
echo "a $creature says: search engine";
break;

case "u3schools":
echo "a $creature says: online web tutorial";
break;

case "iReport":
echo "a $creature says: Action with PDF";
break;

default:
echo "I have not heard of this creature";
break;

};
?>


The Output will be like this:
a u3schools says: online web tutorial

PHP If Else Statement

PHP If.... Else Statement

Sometimes when you write code, you want to perform different actions for different decisions. You can use conditional statement If Else in your code to do this. Conditional statements are the set of commands used to perform different actions based on different conditions. In this tutorial we will look at if...else statement.

The If Statement is a way to make decisions based upon the result of a condition. For example, you might have a script that checks if boolean value is true or false, if variable contains number or string value, if an object is empty or populated, etc. The condition can be anything you choose, and you can combine conditions together to make for actions that are more complicated.

Use the if statement to execute a statement if a logical condition is true. Use the optional else clause to execute a statement if the condition is false. The syntax for If statement looks as follows:

if (condition) {
    statements_1
} else {
    statements_2
}

Condition can be any expression that evaluates to true or false. If condition evaluates to true, statements_1 are executed; otherwise, statements_2 are executed. statement_1 and statement_2 can be any statement, including further nested if statements.

You may also compound the statements using elseif to have multiple conditions tested in sequence. You should use this construction if you want to select one of many sets of lines to execute.

if (condition_1) {
    statement_1
}[elseif (condition_2) {
    statement_2
}][else {
    statement_n
}]

Let's have a look at the examples. The first example decides whether a student has passed an exam with a pass mark of 40:

<?php
$result = 68;
if ($result >= 40) {
    echo "Pass <br />";
} else {
    echo "Fail <br />";
}
?>

PHP Operators

This tutorial explain you how to use PHP operators in your scripts with sample codings. Php variables are great for storing values in your script, but they're not much use on their own. To manipulate variable values and get useful results, you need to use operators.

What are PHP operators?

PHP operators let you combine values together to produce new values. For example, to add two numbers together to produce a new value, you use the + (addition) operator. The following PHP code displays the number 15:

echo 2 + 13;

Common PHP operators

There are many PHP operators, but this article concentrates on the ones you're likely to use most often. These can be broken down into the following operator types: Arithmetic => Carry out arithmetic operations such as addition and multiplication Assignment => Assign values to variables Comparison => Compare 2 values Increment/decrement => Increase or decrease the value of a variable Logical => Perform Boolean logic The following sections explore each of these operator types.

Arithmetic operators

Symbol Name Example Result
+ addition echo 7 + 5 12
- subtraction echo 7 - 5 2
* multiplication echo 7 * 5 35
/ division echo 7 / 5 1.4
% modulus echo 7 % 5 2

Assignment operators

The basic assignment operator is = (an equals sign). This is used to assign a value to a variable

$firstNum = 4;
$secondNum = 2;
$myVariable = $firstNum + $secondNum;

Comparison operators

PHP's comparison operators compare 2 values, producing a Boolean result of true if the comparison succeeded, or false if it failed. You often use comparison operators with statements such as if and while. PHP supports the following 8 comparison operators:

Symbol Name Usage Result
== equal to a == b true if a equals b, otherwise false
!= not equal to a != b true if a does not equal b, otherwise false
=== identical to a === b true if a equals b and they are of the same type, otherwise false
!== not identical to a !== b true if a does not equal b or they are not of the same type, otherwise false
< less than a < b true if a is less than b, otherwise false
> greater than a > b true if a is greater than b, otherwise false
<= less than or equal to a <= b true if a is less than or equal to b, otherwise false
>= greater than or equal to a >= b true if a is greater than or equal to b, otherwise false

Increment/decrement operators

These two operators are very simple — they increase or decrease the value of a variable by 1:

Symbol Name Example Result
++ increment $x++ or ++$x Adds 1 to the variable $x
-- decrement $x-- or --$x Subtracts 1 from the variable $x

Logical operators

PHP's logical operators combine values using Boolean logic. Each value to be combined is treated as either true or false — for example, 1, true, a non-empty string, and a successful comparison are all considered true, while 0, false, an empty string, and an unsuccessful comparison are all considered false. The true and/or false values are then combined to produce a final result of either true or false.

Symbol Name Example Result
&& and a && b true if a and b are true, otherwise false
and and a and b true if a and b are true, otherwise false
|| or a || b true if a or b are true, otherwise false
or or a or b true if a or b are true, otherwise false
xor xor a xor b true if a or b — but not both — are true, otherwise false
! not !a true if a is false; false if a is true

PHP String Functions

String concatenation operator in php

We know very well that concatenation means nothing but join together two strings. In php concatenation operator (.)  is used to join two string values together.

<?php
$txt1="Hello World!";
$txt2="Welcome!";
echo $txt1 . " " . $txt2;
?>

the output of the above programe look like this:
Hello World! Welcome!

Length of a string

The function 'strlen' is used to return the length of the string that is passed as an argument. Syntax of the strlen function is given below

syntax:
strlen(stringname);

Example:
$string="sample";
strlen($string);

Output :
6

Splitting a string into an array

The function 'explode' is used to split a string into an array using a separator. It takes the separator and the string as its argument. Syntax of the explode function is given below

Syntax:
explode(separator,stringname);

Example:
$string="11-02-2005"
explode("-",$string);

Output :
11 in array[0] , 02 in array[1] , 2005 in array[2]

Joining the array elements into a single string

The function 'join' is used to join various array elements into a single string. Alternatively 'implode' can also be used to join array elements into a string. Syntax of the join and implode function is given below

Syntax:
join(separator,arrayname);
(or)
implode(separator,arrayname);

Example:
$arraystring=array("s","sample","java");
implode("/",$arraystring);

Output :
s/sample/java

Repeating a string 'n' times

The function 'str_repeat' is used to repeat a given string 'n' times. The function takes the string and the number of times to be repeated as its argument.yntax of the str_repeat function is given below
Syntax of the str_repeat function:
str_repeat($string,integervalue); 

Example:
str_repeat("welcome! ",2); 

Output :
welcome! welcome! 

Remove HTML tags from the string

The function 'strip_tags' is used to remove the HTML tags present in a string by taking the string as its argument.

Syntax of the strip_tags function is given below
string strip_tags ( string $str [, string $allowable_tags ] )

Example:
<?php
$text = '<p>Web.</p><!-- Comment --> <a href="#">Other text</a>';
echo strip_tags($text);
echo "\n";
// Allow <p> and <a>
echo strip_tags($text, '<p><a>');
?>

Output:
Web. Other text
<p>web.</p> <a href="#">Other text</a>

PHP Data types

Data types in PHP

In PHP the data type of a variable is not set by the programmer. PHP decides the data type of variables after interpreting the web page. Data Types in PHP include:
=> Numeric data type
=> String data type
=> Array data type

Numeric data type

Numeric data type is used for number. There are two different numeric data types:
=> Integer Data Type
=> Double Data Type

Integer Data Type

Integer data types contain whole number values. The below example will show that how to initialize integer data in php

$intmark = 100

Double Data Type

Double contains floating point numbers. The below example will show how to use double datatypes in php

$doubtotal = 99.5;

String Data Type

String data type is used to contain textual information or letters. The value is assigned within quotes as shown below. The below example will show how to use String datatypes in php

$strName = "David";
$strId = "David123";

String Concatenation

String Concatenation is a process of adding two strings. This is done by attaching one string to the end of another string. This is done by using '.' (period) operator as shown below: Below example shows the usage of srting concatenation operator in php

$strFirst_Name = "David";
$strSpace = " ";
$strLast_Name = "John";
$strName = $strFirst_Name.$strSpace.$strLast_Name;
echo $strName;

Output:
David John

Array Data Type

Array data type is used to contain many values in a single variable. Each array element can be retrieved by using the array variable name and its key/index value. We can declare an array variable in different ways as shown below:

Example 1:
$arrMark[0] = 95;
$arrMark[1] = 88;
$arrMark[3] = 77;

Example 2:
$arrMark = array(95,88,77);

In the above example, the variable 'arrMark' contains three different values. In the first method the array elements are stored using the key values (0, 1, 2), but in the second example the keyword 'array' is used to assign values to the array variable. By default, array key element starts with 0.

The array elements can be accessed by using their key values. The different marks stored in the array elements can be added together to obtain the total marks as shown below:

$intTotalMark = $arrMark[0] + $arrMark[1] + $arrMark[2];
echo $intTotalMark;

Output:
260

In the above two examples we have used the key values as numbers, but it not necessary that the key value must be a number, it can also be a string as shown in below example

$arrMark['maths'] = 95;
$arrMark['english'] = 88;
$intTotalMark = $arrMark['maths'] + $arrMark['english'];
echo $intTotalMark;

Output:
183

PHP Variables

Variables in php
In this Tutorial you'll learn about Variables and different Data Types in PHP.

Variable definition

Variables are nothing but identifiers to the memory location to store data. We can create any number of varibles. In PHP all the variables begin with a dollar sign "$" and the value can be assignes using the "=" operator.

$Name, $Name1, $First_Name, $Last_Name
$Name = "Pravin";
$Age = 19

Another important thing in PHP is that all the statements must end with a semicolon ";". In PHP we needn't have to specify the variable type, as it takes the data type of the assigned value. From the above example we understand that '$Name' is of Data type String and '$Age' is of type Numeric.;

Limitations in Variable Naming:

PHP has no limit on the length of variable name as in the case of other programming languages. The variable name must start with a letter or underscore. The variable name must be a combination of letters, numbers and underscores. Other characters such as *, +, #, @ are not allowed and causes error if used.

Comments in php

Comments in php

PHP is unique in that if offer several ways to comment code. There are 2 options for single-line commenting, and another option for multi-line commenting.

Single-line comments in PHP

There are two different ways to insert single-line comments in PHP. One is based on the Unix style for shell scripts, while the other is based on comments in the C++,Java programming environment.

<?php
# This is a comment in PHP using the Unix style
//This is a comment in PHP using the C++,Java style
?>

Which style should you use? Technically speaking, there’s really no benefit or drawback to either. It’s simply a matter of preference.

Multi-line comments in PHP

What if you want to insert a large block of text that shouldn’t be interpreted as code or displayed on screen? This is the perfect opportunity to utilize a multi-line comment. Just like the 2 single-line comment styles, PHP’s multi-line comment is derived from another programming language like Java

<?php
/*
This is a multi-line comment in PHP.
The style for mult-line comments in PHP is
derived from the Java programming language.
Like all comments, none of this will be displayed on screen.
*/
?>

Hello world Program in PHP

Hello world Program in PHP

To get a feel for PHP, first start with simple PHP scripts. Since "Hello, World!" is an essential example, first we will create a friendly little "Hello, World!" script.
A PHP scripting block always starts with . A PHP scripting block can be placed anywhere in the document.

<?php
?>

Below is an example of one of the easiest PHP and HTML page that you can create and still follow web standards.

<body>
<?php
echo "Hello World";
?>
</body>
</html>

The output of this code look like this:

Hello, World!

There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text "Hello World".
echo is most widely using print statement in php. You can print variables to use this echo statement. A small example for print variables in php with html code.

<?php
$my_string = "Hello Bob.  My name is: ";
$my_number = 4;
$my_letter = a;
echo $my_string;
echo $my_number;
echo $my_letter;
?>

output

Hello Bob. My name is: 4a

Friday, 14 December 2012

PHP Installation methods

PHP Installation methods

Install XAMPP

Very simple and easy method is install XAMPP into your system. XAMPP is an easy-to-use multi-platform package that installs Apache, MySQL, PHP, phpMyAdmin, and a whole slew of other software useful for dynamic web development on your computer. Installation is painless, and configuration minimal.
You can freely download XAMPP from http://sourceforge.net/projects/xampp/files/
Also you can study about installation here http://www.apachefriends.org/en/xampp.html This page guides you through installing the package.

Purchase web hosting account

Another method is purchase web hosting account. Web hosting account that supports the use of PHP web pages and grants you access to MySQL databases. If you do not have a host, but are interested in signing up for one, we recommend that you first read Web Hosting Guide from any familiar web hosters to educate yourself about web hosting and avoid getting ripped off.

Install manually

=> PHP Installation Guide on php.net
These guides are kindly provided by PHP.net based on the operating system that you are using.
* PHP - Windows - Windows Installation Guide
* PHP - Mac - Mac Installation Guide
* PHP - Linux - Linux Installation Guide
=> MySQL Instalation
MySQL installation is not compulsary for work with php language. But you have MySQL in your systém means it will helps you future applications.

Visit MySQL's MySQL Installation Guide for help on installing MySQL.

PHP Introduction

PHP Introduction

PHP started out as a small open source project that evolved as more and more people found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994.

* PHP is a recursive acronym for "PHP: Hypertext Preprocessor".
* PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.
* It is integrated with a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
* PHP is pleasingly zippy in its execution, especially when compiled as an Apache module on the Unix side. The MySQL server, once started, executes even very complex queries with huge result sets in record-setting time.
* PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. PHP4 added support for Java and distributed object architectures (COM and CORBA), making n-tier development a possibility for the first time.
* PHP is forgiving: PHP language tries to be as forgiving as possible.
* PHP Syntax is C-Like.

Common uses of PHP:

* PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them.
* PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user.
* You add, delete, modify elements within your database thru PHP.
* Access cookies variables and set cookies.
* Using PHP, you can restrict users to access some pages of your website.
* It can encrypt data.

Characteristics of PHP

Five important characteristics make PHP's practical nature possible:
* Simplicity
* Efficiency
* Security
* Flexibility
* Familiarity

What's PHP?

* PHP stands for Hypertext Preprocessor.
* PHP scripts run inside Apache server or Microsoft IIS.
* PHP and Apache server are free.
* PHP code is very easy.
* PHP is the most used server side scripting language.
* PHP files contain PHP scripts and HTML.
* PHP files have the extension "php", "php3", "php4", or "phtml".

Why PHP?

* PHP runs on different platforms (Windows, Linux, Unix, etc.)
* PHP is compatible with almost all servers used today (Apache, IIS, etc.)
* PHP is FREE to download from the official PHP resource: www.php.net
* PHP is easy to learn and runs efficiently on the server side

Where to Start?

To get access to a web server with PHP support, you can:
* Install Apache (or IIS) on your own server, install PHP, and MySQL
* Or find a web hosting plan with PHP and MySQL support