Q: How can I copy a value from one key of an array to empty keys in PHP? I apologize for not wording the title better. I am open to suggestions for making it more descriptive. 
I have created a multidimensional array from a csv file. However, the csv file is poorly formatted and I end up with arrays that look like my example below. Each array contains data for a toll free number, [INBOUND NUMBER]. However, [INBOUND NUMBER] only has a value for the first day, nothing for the subsequent days. It is human readable when opened in Excel but I need to make this more uniform so I can process it in PHP. 
Using PHP, how can I take the value from the first [INBOUND NUMBER] and copy it to the [INBOUND NUMBER] for the other days?  
Here's a slimmed down example for two fictional toll free numbers for the month of February: 
Array
        (
            [INBOUND NUMBER] => 8005555555
            [DATE] => 2/1/2015
            [TOTAL CALL DURATION] => 0
        )

    [1] => Array
        (
            [INBOUND NUMBER] => 
            [DATE] => 2/2/2015
            [TOTAL CALL DURATION] => 0
        )

    [25] => Array
        (
            [INBOUND NUMBER] => 
            [DATE] => 2/26/2015
            [TOTAL CALL DURATION] => 0
        )

    [26] => Array
        (
            [INBOUND NUMBER] => 
            [DATE] => 2/27/2015
            [TOTAL CALL DURATION] => 0
        )

    [27] => Array
        (
            [INBOUND NUMBER] => SUBTOTAL - 8005555555
            [DATE] => 
            [TOTAL CALL DURATION] => 12.52
        )

[1] => Array
        (
            [INBOUND NUMBER] => 8006666666
            [DATE] => 2/1/2015
            [TOTAL CALL DURATION] => 0
        )

    [1] => Array
        (
            [INBOUND NUMBER] => 
            [DATE] => 2/2/2015
            [TOTAL CALL DURATION] => 0
        )

    [25] => Array
        (
            [INBOUND NUMBER] => 
            [DATE] => 2/26/2015
            [TOTAL CALL DURATION] => 0
        )

    [26] => Array
        (
            [INBOUND NUMBER] => 
            [DATE] => 2/27/2015
            [TOTAL CALL DURATION] => 0
        )

    [27] => Array
        (
            [INBOUND NUMBER] => SUBTOTAL - 8006666666
            [DATE] => 
            [TOTAL CALL DURATION] => 16.32
        )

Notes:


*

*Fixing the formatting in the csv file via Excel is an option but it
would be extremely time consuming (there are thousands of rows when
opened in Excel).

*The last entry for the month is a sum of the data for that number and
[INBOUND NUMBER] has a different value of SUBTOTAL - 8005555555 on that line which would either need to stay the same or be removed from the array. (I don't really need that line and will be ignoring it in my script.) 

A: At it's simplest (you could do this while reading in from the CSV):
$in = '';

foreach($array as &$value) {
    if(!empty($value['INBOUND NUMBER'])) {
        $in = $value['INBOUND NUMBER'];
    } else {
        $value['INBOUND NUMBER'] = $in;
    }
}

If the first INBOUND NUMBER in the sub-array is blank then obviously it won't change any of the following until it encounters one with a value.

A: <?php
$number = '';
for ($i = 0; $i < count($rows); $i++) {
    if (isset($rows[$i]['number'])) {
        $number = $rows[$i]['number'];
    } else {
        $rows[$i]['number'] = $number;
    }
}
?>

