This helps if you have multiple CSV's with the same format and you want to merge them:

PHP Code:
$files_to_merge = array(
"csv1.csv",
"csv2.csv",
"csv3.csv",
"csv4.csv"
);
$ftm fopen("merged.csv","w+");
foreach (
$files_to_merge as $file):
//loop through array
    
$fh fopen("csv/" .$file"r");
    
$line false;

    while ((
$data fgetcsv($fh,8192,",")) != FALSE){
        
//ignore first line
        
if (!$line){
            
//ignore
            
$line TRUE;
        } else {
            
fputcsv($ftm,$data,",");
        }
        
//write content to new file
    
}
    
fclose($fh);
    echo(
$file "-"$count "\n");
    
//merge the records
endforeach;
fclose($ftm);