title: Can't use anything with "+" when using fopen in PHP
body: <p>I want to read &amp; write <code>.txt</code> file in <code>PHP</code>, I already can read the file using</p>
  
  <pre><code>$Readfile = fopen("file.txt", "r") or exit("Unable to open file!");
  </code></pre>
  
  <p>Since I want to overwrite the file, I got suggest to use</p>
  
  <pre><code>$Readfile = fopen("file.txt", "r+") or exit("Unable to open file!");
  </code></pre>
  
  <p>But always end up get "Unable to open file!" I also have tried using other like <code>w+</code> but still not giving any result. here some update of my code</p>
  
  <pre><code>&lt;?php
          //$Readfile = fopen("pengumuman.txt","r") or exit("Unable to open file!");
          $Readfile = file_get_contents("pengumuman.txt");
          if (isset($_POST["btnSimpan"])) {
              $pengumuman = $_POST["pengumuman"];
              fwrite($Readfile, $pengumuman);
          }
  ?&gt;
  
  &lt;textarea class="span12" style="min-height: 200px; height: auto;" name="pengumuman"&gt;
  &lt;?php
       while(!feof($Readfile)) {
       echo fgets( $Readfile);
       }
  ?&gt;
  </code></pre>
  
  <p>i tried <code>file_get_contents</code> but it give me a long loading and blank text area</p>