将新数组添加到现有值并保存回数据库

How to add an additional array directly in PHP?

For Example I have two item in an array

Array(
   [1] => Fruits

   [2] => Books

)

Assume my data.. I have an array called House

House contains 2 data which is Fruits and Books.

now I would like to add colors onto Fruits and Books with another array.

I did like this :

$house = $this->config->get("house");  //now I get the main array contains Fruits and Books

foreach($house as $house_content => value) // get the value for each eg. Fruits, Books
   if(!is_array($value)){ //check whether Fruits is an array cause I wanna add array of color into it
    $house[$house_content][red] = $value;  // can I do like this to make it create another array name [red] under the Fruits or Books?
  }

I failed to do so.. how should I make it [Fruits][red] while they are originally [Fruits] only?

you question is really confusing

maybe u should use for eg:

$house[$house_content]['color'] = array('red','green','blue','orange');
$a=array("Fruits"=>array("red"=>"Apple","yellow"=>"Mango"));
foreach($a as $house_content=>$values)
{
    echo $values['red'];
//print_r($house_content['red']);
}