generates a csv file from a php array