Question: I have an array that I want to export to a CSV file, now I know that there is a fputcsv function but I am using version 5.0.4 of PHP so this isn't an option for me.

Is there an alternative method I can use?

Answer: 
Assuming you have a `$Data` array, which contains individual arrays for each registry (or line), you may try this:

```
$Delimiter = '"';
$Separator = ','
foreach($Data as $Line)
{   
 fwrite($File, $Delimiter.
        implode($Delimiter.$Separator.$Delimiter, $Line).$Delimiter."\n");
}

```

Where `$File` is the handle for your file. Put in `$Delimiter`, the character you want to put around each field, and in `$Separator`, the character to use between fields.
I took the solution from @Orangepill and refactored / simplified it in a couple of ways. This may also become handy if you want every field to be enclosed which is not the case in the default php implementation.

```php
function fputcsv_custom($handle, $fields, $delimiter = ",", $enclosure = '"', $escape_char = "\\") {
    $field_arr = [];

    foreach($fields as $field) {
        $field_arr[] = $enclosure . str_replace($enclosure, $escape_char . $enclosure, $field) . $enclosure;
    }

    fwrite($handle, implode($delimiter, $field_arr) . "\n");
}

```