Reputation: 1600
I'm trying to get the array key
name of the following:
[tax_input] => Array
(
[property-category] => Array
(
[1] => 4
[2] => 8
)
[property-action] => Array
(
[1] => 9
)
)
so I'm iterating it as:
foreach($tax_input as $key => $tax)
{
var_dump($tax_input[$key]);
}
but this return an empty string, what I did wrong?
Upvotes: 0
Views: 67
Reputation: 491
If you want to get key only then use
foreach($tax_input as $key => $tax)
{
var_dump($key);
}
Upvotes: 1
Reputation: 130
try this one.
foreach($tax_input as $k => $v)
{
foreach( $v as $vk => $vv ){
var_dump( '<pre>',$vv );
}
}
Upvotes: 0