I have this JSON string:
"Filters": [
{"IsActive" : "1"},
{"Gender" : "M"}
]
That I'm converting into an array $filters
. When I var_dump
I get:
array(2) {
[0]=>
array(1) {
["IsActive"]=>
string(1) "1"
}
[1]=>
array(1) {
["Gender"]=>
string(1) "M"
}
}
I am trying to access the Key / Value pairs. The Keys are not always Gender
, or IsActive
. They can be anything, with any value.
foreach ($filters as $key => $value) {
echo "
Filter: " . $key . " => " . $value;
}
But it outputs:
Filter: Array => Array
Notice: Array to string conversion in
Why am I unable to access the k/v pairs?