Alternative to fputcsv as it is banned

Hi can anyone help me with alternative to php function fputcsv which is banned by sugar

Thanks in advance