0
$row_properties = array(
                         "Header 11"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255),"text_color"=>array(220,50,50)),
                         "Header 12"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255),"text_color"=>array(220,50,50) )

);

How I can Push the values

"Header 13"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255) ,"text_color"=>array(220,50,50)),
"Header 14"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255) ,"text_color"=>array(220,50,50)),

SO it will got the result

$row_properties = array(
"Header  11"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255),"text_color"=>array(220,50,50)),
"Header12"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255),"text_color"=>array(220,50,50),
"Header 13"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255) ,"text_color"=>array(220,50,50)),
"Header 14"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255) ,"text_color"=>array(220,50,50))
                  )
              );

3 Answers 3

1

Simple

$row_properties["Header 13"] = array("width"=>20,"align"=>'C',"color"=>array(100,220,255) ,"text_color"=>array(220,50,50));
Sign up to request clarification or add additional context in comments.

Comments

1

Tried the array_merge() function?

Comments

0

Maybe something like this:

$push_vals = array(
    "Header 13"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255) ,"text_color"=>array(220,50,50)),
    "Header 14"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255) ,"text_color"=>array(220,50,50)),
);

$arr = array(
     "Header 11"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255),"text_color"=>array(220,50,50)),
     "Header 12"=>array("width"=>20,"align"=>'C',"color"=>array(100,220,255),"text_color"=>array(220,50,50)
);

foreach ($push_vals as $key=>$value){
    if ( isset($arr[$key]) ) 
        $arr = array_merge($arr[$key], $push_vals[$key]);
    else
        $arr[$key] = $push_vals[$key];

}

Update

durrr array_merge_recursive

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.