使用fopen编写2个文件

Am joining multiple CSV files using a script below and writing a file.

How can I write the same content and create two different files with different file names?

/////////// ---- JOINING THE FILES ---- ///////////

$nn = 0;
foreach (glob("*.csv") as $filename) {

if (($handle = fopen($filename, "r")) !== FALSE) {

    while (($data = fgetcsv($handle, 0, ",")) !== FALSE) {
        $c = count($data);
        //$csvarray[$nn][] = $filename;
        for ($x=0;$x<$c;$x++)
        {
            $csvarray[$nn][] = $data[$x];
        }
        $nn++;
    }

    fclose($handle);
}

}

$fp = fopen("../newfile.csv", "w");//output file set here

foreach ($csvarray as $fields) {
fputcsv($fp, $fields);
}

// Need to create another file with the same contents here!!

fclose($fp);
$fp1 = fopen("../newfile1.csv", "w");//output file set here
$fp2 = fopen("../newfile2.csv", "w");//output file set here

foreach ($csvarray as $fields) {
    fputcsv($fp1, $fields);
    fputcsv($fp2, $fields);
}

I realized I could do this.. after the line..

// Need to create another file with the same contents here!!

$fq = fopen("../another_new_file.csv", "w"); 

foreach ($csvarray as $fields) {
   fputcsv($fq, $fields);
}