Concatenate files in PHP
It's probably much faster to use the cat
program in linux if you have command line permissions for PHP
system('cat txt1 txt2 > txt3');
If you want to use a pure-PHP solution, you could use file_get_contents
to read the whole file in a string and then write that out (no error checking, just to show how you could do it):
$fp1 = fopen("txt1", 'a+');
$file2 = file_get_contents("txt2");
fwrite($fp1, $file2);