Question: how can i print the whole multidimensional array by using foreach?

```
<?php

$shop=array                                             // main array
(
"laptop"=>array

(
"conpaq",
"IBM",
"DELL",
"Lenovo"
),

"printer"=>array

(
"canon",
"Hp"
),

"Tabs"=>array
(
"Hp",
"Dell",
"deny"
)

);  

```

Answer: 
This one is a simple list using recursion, it also have tabs to make it more clear when there's a new array-group.

Please try it and adjust for your code.

```
$shop = array(
        'computers' => array(
                'dell' => array(
                        'i7' => array(
                                'model1' => 'Model 1',
                                'model2' => 'Model 2',
                        ),
                        'i5' => 'Model 1'
                ),
                'hp' => array(
                        'model1' => 'Model 1'
                )
        ),
        'printers' => array(
            'Epson' => 'Model 1'
        )
);

function printProducts($products, $tabsCount = 0){
    $result = ''; $tabs = '';
    for($i = 0; $i < $tabsCount; $i++){ $tabs .= '&emsp;'; }
    foreach($products AS $index=>$product){
        if(is_array($product)){
            $result .= $tabs.$index.'<br>';
            $result .= printProducts($product, $tabsCount+1);
        }else{
            $result .= $tabs.$product.'<br>';
        }
    }
    return $result;
}

echo printProducts($shop);

```

Ask if there is something you don't understand.
for 2 levels and without recursion. Recusion would be better but this will work.

```
foreach($shop as $value) { 
  if (is_array($value)) {
    foreach($shop as $value) { 
      echo "$value<br />";
    }
  } else {
    echo "$value<br />";
  }
} 
?>

```