Hi all, quite a strange problem here. I have a csv file with rows:

20/12/2011 4.75 4.75 4.53 4.55 94.74 432.98 4.57
21/12/2011 4.38 4.38 4.38 4.38 20.9 91.54 4.38
22/12/2011 4.19 4.19 4.17 4.17 8.54 35.71 4.18
23/12/2011 3.86 4.35 3.84 4.22 149.49 625.81 4.19
24/12/2011 4.33 4.33 4.33 4.33 27.22 117.88 4.33

I am pulling those into an array with the code:

$row = 1;

    if (($handle = fopen($inputFile, "r")) !== FALSE) 
        {       
            while (($data = fgetcsv($handle, 50)) !== FALSE) //While not end of file
                {           
                    $num = count($data);
                    $row++;

                        for ($c=0; $c < $num; $c++) 
                            {
                                $data[$c] = (str_getcsv($data[$c], ' '));
                                $finalData[] = $data[$c];                               
                            }
                }       
            fclose($handle);
            return $finalData;
        }

This is producing a very strange result. The array it returns looks like this:

    [0] => Array
        (
            [0] => 20/12/2011
            [1] => 4.75
            [2] => 4.75
            [3] => 4.53
            [4] => 4.55
            [5] => 94.74
            [6] => 432.98
            [7] => 4.57
        )

    [1] => Array
        (
            [0] => 21/12/2011
            [1] => 4.38
            [2] => 4.38
            [3] => 4.38
            [4] => 4.38
            [5] => 20.9
            [6] => 91.54
            [7] => 4.38
        )

    [2] => Array
        (
            [0] => 22/12/2011
            [1] => 4.19
            [2] => 4.19
            [3] => 4.17
            [4] => 4.17
            [5] => 8.54
            [6] => 35.71
            [7] => 4.18
        )

    [3] => Array
        (
            [0] => 23/12/2011
            [1] => 3.86
            [2] => 4.35
            [3] => 3.84
            [4] => 4.22
            [5] => 149.49
            [6] => 625.81
            [7] => 4.19
        )

    [4] => Array
        (
            [0] => 
        )

    [5] => Array
        (
            [0] => 24/12/2011
            [1] => 4.33
            [2] => 4.33
            [3] => 4.33
            [4] => 4.33
            [5] => 27.22
            [6] => 117.88
            [7] => 4.33
        )

As you can see, one array is empty, but there is nothing in the CSV file to suggest why. The strange this is that it carries on to the next date in the timeseries as if everything is fine...

Can someone shed some light on this??

Furthermore, using array_filter($data); does nothing - the blank value is still there!

Given that array_filter is supposed to get rid of null, '', or false values - surely something more sinister is happening?

Look at the array through var_dump(), it may add some information about that index.

Yeah, that's what I was doing. I've just figured it out (another silly mistake). I set the line length to 50, when some lines were larger than that. Caused all the issues!