note 67037 deleted from function.fputcsv by bjori
| From: | bjori@php.net | Date: | Fri, 02 Jun 2006 12:27:05 +0000 |
| Subject: | note 67037 deleted from function.fputcsv by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-112958@lists.php.net to get a copy of this message | ||
Note Submitter: chappy at citromail dot hu
Reason: useless
----
There's a basic function with array-checking.
<?php
if(!function_exists('fputcsv')){
function fputcsv(&$handle,$fields,$delimiter=',',$enclosure='"'){
if(is_array($fields)&& count($fields>0)){
$data=$enclosure.str_replace($enclosure,
$enclosure.$enclosure,
array_shift($fields)).$enclosure;
foreach($fields as $field){
$data.=$enclosure.str_replace(
$enclosure,
$enclosure.$enclosure,
$field).$enclosure;
}
$data.="\n";
return fwrite($handle,$data);
}else{
return false;
}
}
}
?>