Add contents of 1 file to the top of another file without overwrite in PHP?

i stuck on here . i have function which rename the my text files when first one is amended.

function copyFiles(string $newLine) : void
{

    rename( "file4.txt", "file5.txt");    
    rename( "file3.txt", "file4.txt");    
    rename("file2.txt", "file3.txt");
    rename("file1.txt", "file2.txt");

file_put_contents("file1.txt",$newLine."\n", FILE_APPEND|LOCK_EX);
}

and i need to take content from the last file5.txt and put it in another text file named fullnews.txt

if the content in fullnews.txt is Hello World and in file5.txt is Good afternoon World

after when i amend the first file i need fullnews.txt to look like

Good afternoon World
Hello World

Solution 1:

I think the best way to go about this for such small strings is to read and store the contents of the file5.txt, and then append the read content to fullnews.txt.

$content = file_get_contents("file5.txt");
file_put_contents("fullnews.txt", $content, FILE_APPEND);