I have a nested associative array like this:
$inputTypes= array(
"natural" => array(
"text",
"password",
"textarea",
"radio",
"checkbox",
"file"
),
"hybrid" => array(
"image",
"date" ,
"url",
"email"
)
);
I want to print its key names, applying code shown below:
foreach ($inputTypes as $inputs){
echo key($inputTypes).'<br>';
}
but i get this output
hybrid
hybrid
How can i get name of each keys, thanks.
1 Answer