1.

An array in PHP is given as follows:Sfamily = array (“Father”=>”Ajay”, “Son”=>”Arjun”, “Daughter”=>” “Archana”); Name the type of this array. Write a for each loop that prints all the array elements.

Answer»

This array is called associative array

<?PHP

$family= array(“Father” =>“Ajay”, “Son”=>

“Arjun”, “Daughter” =>“Archana")

for each($family as $key =>$name)echo “$key – 

$name”. “, “;

?>



Discussion

No Comment Found