Free Tutorial PHP














Table of Contents:





Embedding PHP

Variables

Operators and Control Structures

Array

Function

Session Control (Using Cookie)





--------------------------------------------------------




Sample of the pdf document :










Embedding PHP in HTML:

⇨ Insert PHP tag inside HTML file (with .php extension

⇨ XML Style
<?php PHP statement; ?>

⇨ Short Style (Need to be enabled)
<? PHP statement; ?>

⇨ Script Style
<SCRIPT LANGUAGE='php'> PHP statement;
</SCRIPT>

⇨ ASP Style (Need to be enabled)
<% PHP statement; %>

⇨ Dynamic Content
function('argument');

⇨ Note: argument is in string


Operators and Control Structures:

⇨ Pretty much same as in other programming
languages (C, Java, etc.)
⇨ Break statements are also same (continue,
break), except it provides exit statement to
break out of the script
⇨ Alternative control structure syntex
if( $totalqty == 0):
echo 'You did not order anything on the previous
page!<br />';
exit;
endif;


Array:

⇨ Create an array
$products = array ('Tires', 'Oil', 'Engine');

⇨ Automatically generate sequnces of
number, character
$numbers = range (1,10,2); //last parameter optional(Indicate step)

⇨ Accessing element
$products[0]

⇨ Array with different indices
$prices = array( 'Tires'=>100, 'Oil'=>10, 'Spark Plugs'=>4 );

⇨ Assign key and value to variables
list( $product, $price ) = each( $prices );.............








 Click here for  Download PDF / FREE



0 commentaires: