Saturday, December 22, 2012

arrays


Ab bari hai array ki:- total 3 types ke hotey hai
Numeric array:-
Variable  sirf ek hi value store kar pata hai isliye hamein array concept find karna pada
Waise array bhi ek variable hi hai isey hum we call it special variable
$car1=”maruti”
$car2=”nano”
…………… 40 se 50 ho to kya karogey use array kkey
Like
$cars[0]="Saab";            //I gues this is easy one just add[]
$cars[1]="Volvo";
$cars[2]="BMW";
$cars[3]="Toyota";
Ya phir kuch aisey
$cars=array("Saab","Volvo","BMW","Toyota");   //this takes less time now depend upon urs
Yeh 0,1,2 aise hi nahi lagey hai inka use hai kafi
In output like    echo $cars[0] . " and " . $cars[1] . " are Swedish cars.";

Associative array :-
When storing data about specific named values, a numerical array is not always the best way to do it.
Kuch ni kartey 0,1,2 ki jagah strings use kartey hai
$ages['Peter'] = "32";
$ages['Quagmire'] = "30";
$ages['Joe'] = "34";

echo "Peter is " . $ages['Peter'] . " years old.";
?>

Multidimensional array:  automatically keys assign hoti hai like 1234 …

No comments:

Post a Comment