如何将这部分数组复制到php中的新数组?

I have this php array X.

X= array(
    'Parent' => array(
        'title' => '123',
    )
)

I have this php array Y.

Y = array(
    'Parent' => array(
        'id' => '16',
        'title' => 'T1',
    ),
    'Children' => array(
        (int) 0 => array(
            'id' => '8',
            'serial_no' => '1',
        ),
        (int) 1 => array(
            'id' => '9',
            'serial_no' => '2',
        ),
        (int) 2 => array(
            'id' => '14',
            'serial_no' => '6',
        )
    )
)

I want to copy the Children of array Y to the parent of array X to form array Z such that it looks like this;

Z= array(
        'Parent' => array(
            'title' => '123',
        )
        'Children' => array(
            (int) 0 => array(                   
                'serial_no' => '1'
            ),
            (int) 1 => array(
                'serial_no' => '2'
            ),
            (int) 2 => array(
                'serial_no' => '6'
            )
        )
    )

Please note that the id key-value pair was removed from the Children of array Y.

I wrote some code of my own.

            $Z = array();
            $i=0;
            foreach($Y as $temp) 
            {
                $Z['Children'][$i] = $temp['Children'][$i];     
                unset($Z['Children'][$i]['id'];
                $i++;
            }    
            $Z['Parent']=$temp['Parent'];

Unfortunately, there is an undefined index error. How can this be done in php? Forget about my code if there are better approaches.

Actually your approach works too, but you need to iterate over sub-array:

$Z = array();
$i=0;
foreach($Y['Children'] as $temp) 
{
    $Z['Children'][$i] = $temp;     
    unset($Z['Children'][$i]['id'];
    $i++;
}

or what I may do:

$Z = $X;
$Z['Children'] = array();
foreach ( $Y['Children'] as $child ) {
    $Z['Children'][] = array(
        'serial_no' => $child['serial_no'],
    );
}

You can do like.

   $Z = array();
   foreach($Y['Children'] as $temp) 
   {
      $Z['Children'][] = array('serial_no' => $temp['serial_no']);     
   }    
   $Z['Parent']=$X['Parent'];