I am having difficulties in changing the values of a nested array. I am trying to change the 'admin' => '1'value to 'admin' => '0' of each nested array. I tried a foreach loop but the logic is not correct. How can I correct this? or is there a better way?
Array
'user' => array(
// Regular user, admin
array(
'id' = '1'
'admin' => '1',
),
array(
'id' = '2'
'admin' => '1',
),
array(
'id' = '3'
'admin' => '1',
),
)
Loop:
foreach ($users as $admin => $value) {
if ($value == 1) {
$value == 0;
}
}