title: how to add value in txt file with php
body: <p>I want to add a value (not overwrite!) to a txt file with <code>file_put_contents</code></p>
  
  <p>This is what i have so far:</p>
  
  <pre><code>$fileUserId = fopen("fileUserId.txt", "w") or die("Unable to open file!");
  $UserIdtxt = $UserID."||";
  file_put_contents("fileUserId.txt", $UserIdtxt, FILE_APPEND);
  fclose($fileUserId);
  </code></pre>
  
  <p><code>$UserID</code> is an integer, like 1, 2, 3 etc.</p>
  
  <p>So when the the UserID is 1, the <strong>fileUserId.txt</strong> looks like this:</p>
  
  <p><code>1||</code></p>
  
  <p>When there is another user with ID 2, 
  the <strong>fileUserId.txt</strong> should look like this:</p>
  
  <p><code>1||2||</code></p>
  
  <p>But he overwrites the file so it becomes this:</p>
  
  <p><code>2||</code></p>
  
  <p>What i am doing wrong?</p>