hi i want to echo multidimansional array by using for each loop...
i m doing it but i m not able to do...
i hope some onwe will help me..

my code is

$Families = array ( "Farhad" =>array("Ali","Haider","Kashan"), "Sufyan" => array("Shahbaz","Ali2","Azaan"));

foreach($Families as $key2=>$values3)
{
	echo "$key2 $values3";
}

how to print all the values?
Regards..

Add a loop:

$Families = array ( "Farhad" =>array("Ali","Haider","Kashan"), "Sufyan" => array("Shahbaz","Ali2","Azaan"));
 
foreach($Families as $key2=>$values3)
{
        foreach($values3 as $v)
        {
            echo "$key2 $v";
        {
}

bye :)

Thanks man..done it :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.