Convert an array in to CSV.
App::Utility()->checkfile(array)
Parameter |
Description |
---|---|
array |
A One Dimensional Arrays |
See bellow example:
//Example 1
$data = array(1111,2222,3333,"Data 1", "Data 2","Data 3");
echo App::Utility()->convertArrayToCsvString($data);
// Example 2
$data = array(
array("id"=>5, "code" => "A","range" => 1),
array("id"=>15, "code" => "B","range" => 2),
array("id"=>56, "code" => "C","range" => 3)
);
foreach($data as $row){
echo App::Utility()->convertArrayToCsvString($row);
}