Following is the output of my multidimensional array $csmap_data
Array
(
[0] => Array
(
[cs_map_id] => 84
You can also do it using php array functions
$csmap_data = array_map(function($arr){
return $arr + ['flag' => 1];
}, $csmap_data);
UPDATE:
to use multiple variables in callback function of array_map
function we can do it by use
$flagValue = 1;
$csmap_data = array_map(function($arr) use ($flagValue){
return $arr + ['flag' => $flagValue];
}, $csmap_data);
<?
foreach($csmap_data as $key => $csm)
{
$csmap_data[$key]['flag'] = 1;
}
That should do the trick.