I have a large 2 column csv file ("data.csv") with a weeks worth of data. Column one has unix time stamps Column two has strings:
1329548400,cats
1329548400,dogs
1329550200,fish
1329550200,cats
1329552000,dogs
1329552000,fish
1329584400,cats
1329584400,dogs
1329550200,cats
Via php, I need to convert data.csv into 7 files, Sunday.csv, Monday.csv...Saturday.csv
If I could grab each row, I know I can do something like
$temp = "data.csv";
$fileName = array_unique($temp);
foreach ($fileName as $row) {
    $theDay = date("Y", $row[firstcolumn]);
    if ($theDay == "Sunday") {
        $fileToWriteTo = "Sunday.csv";
        $f = fopen($fileToWriteTo, "a");
        fwrite($fileToWriteTo, $row . "\n");
        fclose($fileToWriteTo);
        }
    if ($theDay == "Monday") {
        $fileToWriteTo = "Monday.csv";
        $f = fopen($fileToWriteTo, "a");
        fwrite($fileToWriteTo, $row . "\n");
        fclose($fileToWriteTo);
        }
    }
Problem is
1) I don't know how to read each row of data.csv, assuming the syntax above is wrong 2) I admit Im a bit of a php laymen :)
...how far off am I? Am I even in the ballpark?