在php中放一个数组末尾的键

I have this array:

Array
(
[0] => Array
    (
        [date] => 2016-03-08
        [value] => Array
            (
                [key_1] => Array
                    (
                        [test_1] => 1
                        [test_2] => 10
                        [test_3] => 1000
                        [test_4] => 200
                    )

                [key_2] => Array
                    (
                        [test_1] => 1
                        [test_2] => 15
                        [test_3] => 1500
                        [test_4] => 100
                    )

             )
)

Now I have another array :

Array
(
  [key_3] => Array
    (
        [test_1] =>
        [test_2] =>
        [test_3] =>
        [test_4] => 1
    )

) I want to add this last array in the first array. I try like this : array_push($ymlParsedData[]['value'], $a_big_gift); but not work. Can you help me please ?

You can't use $ymlParsedData[] for accessing specific element, it is a shorthand for pushing data to array.

You can use either

// NB! array_push() just adds the values, key 'key_3' is removed
array_push($ymlParsedData[0]['value'], $a_big_gift);

or

// will keep key 'key_3'
$ymlParsedData[0]['value']['key_3'] = $a_big_gift['key_3'];

or

// use array_merge() instead
$ymlParsedData[0]['value'] = array_merge($ymlParsedData[0]['value'], $a_big_gift);

A complicated answer, but this might solve your issue:

$key_name = array_keys($a_big_gift)[0];
$ymlParsedData[0]['value'][$key_name] = $a_big_gift[$key_name];

echo '<pre>'; print_r($ymlParsedData); exit;

Note: For making it dynamic and for more than one value of $a_big_gift, you need to loop it and achieve your result.

Try this

array_push($ymlParsedData[0]['value'], $a_big_gift['key_3']);