so, this only creates the date. I need to extend it to include the "Description" and the "Amount". I'm not entirely sure how to extend the array to be a multi-dimensional array. Also, in the code above, I don't understand why the function calls itself ?

Once I have the multi-dimasional array sorted out, and how to reference each key/index and value, then I should be okay to extend it for the other iterations. I see there are some easy examples at http://php.net/manual/en/function.fputcsv.php for writing an array to a CSV file.

also for function calling itself, google "recursive function", you will get the answer

Yes, I know what recursive means. My question was, why was there need for the function to call itself ? Is there a better way to do this. I suppose if the function didn't call itself, the code would have to be within a "while" loop, is that correct ?