Q:

PHP format an array of arrays into a flat array

I have an generated array into this format and want to generated a second array to fit into a file that expects the specific format
This is the array i have :
(int) 0 => array(
        [Service] => Array
        (
            [id] => 6948229
            [document] => Array
                (
                    [number] => 0003928425
                )
        )

This is the array i want to build from the previous array (will have many indexes)
verified[id]
verified[number]

So far i build this script:
foreach($data as $key=>$value )
        {
            echo '<br>key '.$key;
            foreach($value as $k=>$v)
            {
                $Verified[$key]['id'] = $v["id"];
                $Verified[$key]['number'] = $v['document']['number'];

But just get undefined index error message. 
Which indexes i must use to get the flatten array ?  

A:

From what I can make from your question, you can do something like this to get the desired output,
    $Verified = []; //use array() for versions below 5.5
    foreach($data as $key=>$value )
            {
                echo '<br>key '.$key;
                foreach($value as $k=>$v)
                {   
                    if(is_array($v)){
                        $Verified[$key]['number'] = $v['document']['number'];
                    }
                    $Verified[$key]['id'] = $v['id'];

