I have an array
:
$cats = array(
'guitars' => array (
'electric-guitars',
'acoustic-guitars',
'bass',
'electro-acoustic',
'effects-fx-pedals',
'guitar-amps',
'classical-guitars',
'guitar-recording',
'folk',
'cases-stands',
'guitar-care',
'guitar-accessories'
),
'drums',
'keyboards',
'studio',
'computer',
'dj-pa',
'brass',
'accessories'
);
And I'm trying to output the top level keys so it outputs the following:
guitars
drums
keyboards
studio
computer
dj-pa
brass
accessories
I'm using this foreach
loop:
foreach($cats as $cat => $cat_name) {
echo '<div>' . $cat_name . '</div>';
}
But this instead outputs:
Array
drums
keyboards
studio
computer
dj-pa
brass
accessories
If anyone can help it'd be greatly appreciated!