Export php array into csv file using php
<?php
$list = array (
array('id', 'name' ),
array('01', 'saddam hussain'),
array('02', 'sam saifi')
);
$fp = fopen('file.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
<?php
$list = array (
array('id', 'name' ),
array('01', 'saddam hussain'),
array('02', 'sam saifi')
);
$fp = fopen('file.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
Comments
Post a Comment