I'm struggling with my array. I get a array like this:
Array
(
[state] => Array
(
[0] => Array
(
[state] => 1
)
[1] => Array
(
[state] => 2
)
)
)
I want to change the 1 to 'active' and the 2 to 'inactive'. I've allready a controller which get this 1 and 2. Controller look likes:
if ($name == 'state') {
foreach ($dropdownArray[$name] as $arrayName) {
if ($arrayName[$name] == '1') {
echo $arrayName[$name];
$arrayName[$name] = 'active';
} else {
echo $arrayName[$name];
$arrayName[$name] = 'inactive';
}
}
}
With $name I get the value from the dropdown field. So in this case $name = state.
As expected, I get the 1 and 2 in an echo. So he get the good values. But how to set this values to Active and Inactive?