I have array which is presenting like this:
$array = array (
"list" => array(
"serwer-1" => 3
),
"servers" => array(
3 => array(
"msg" => "{'some data': 123123121313}",
"status" => 200
),
),
);
I want add new items to $array['list'] for example:
array (
"list" => array(
"serwer-1" => 3
//NEW DATA HERE
"serwer-2" => 7,
),
"servers" => array(
3 => array(
"msg" => "{'some data': 123123121313}",
"status" => 200
),
),
);
Maybe it's trivial, but I haven't any idea how to do this - I have bad day today :(
In order to add a key-value pair to an existing array just do it like the key exists there.
$array["list"]["serwer-2"] = 7;
Then you will get desired result.