title: PHP: Join two files into one
body: <p>there are two files one of which is a binary (a simple exe file). How can I use PHP to add some textual information to the end of this exe file (for example, from another text file)? </p>
  
  <p>Any file manager seamlessly appends text to the end of the executable file, but is it possible to do using PHP?</p>
  
  <p>UPDATE: Thanks a lot to @arkascha!</p>
  
  <pre><code>$file = 'original_file.exe';
  $newfile = 'new_file.exe';
  copy($file, $newfile);
  $handle=fopen("new_file.exe", "a+"); 
  fwrite($handle, "777777");
  fclose($handle);
  </code></pre>
  
  <p>And we have a working exe file with the text "777777" at its end.</p>