Continuo a non capire bene. In ogni caso, da quello che ho potuto vedere, personalmente utilizzere un codice come questo (oppure una versione ancora più compatta, se possibile):

Codice PHP:
<?php 

$files 
= array();
$files[1] = array('A' => 'R1SF10/1.txt''B' => 'R1SF10/2.txt''C' => 'R1SF10/3.txt'/* etc. */);
$files[2] = array('A' => 'R1SF10/1.txt''B' => 'R1SF10/2.txt''C' => 'R1SF10/3.txt'/* etc. */);
$files[3] = array('A' => 'R1SF10/1.txt''B' => 'R1SF10/2.txt''C' => 'R1SF10/3.txt'/* etc. */);

if (isset(
$files[1][$primo])) {
    
$testo "x";
    if (
file_put_contents($files[1][$primo], $testo) === false) {
        echo(
"result=error");
    }
}

if (isset(
$files[2][$secondo])) {
    
$testo "x";
    if (
file_put_contents($files[2][$secondo], $testo) === false) {
        echo(
"result=error");
    }
}

if (isset(
$files[3][$terzo])) {
    
$testo "x";
    if (
file_put_contents($files[3][$terzo], $testo) === false) {
        echo(
"result=error");
    }
}

?>
P.S.
Per il futuro, ti pregherei di utilizzare, ove possibile, il bbCode PHP in modo da rendere più facile, a chi si offre di aiutarti, capire il codice che posti.