I am trying to add another key and value to the an array inside the foreach loop. I have the following array.
array (size=2)
0 =>
object(stdClass)[27]
public 'ID' => string '1' (length=1)
public 'sectiontitle' => string 'Personal Information' (length=20)
public 'field_format' => string 'vertical' (length=8)
public 'status' => string '1' (length=1)
and the php code
foreach ($query->result() as $row) {
$data[] = $row;
}
var_dump($data);
return $data;
i would like to add key [fields] and value string to it.
foreach ($query->result() as $key=>$value) {