title: About a file pointer in PHP
body: <p>I am just now training <code>PHP</code>.
  About the following code,I read a schedule from file,and overwrite or delete if there is given line <code>number($lineNo)</code> in file.</p>
  
  <p>Then I have a question.
  Is when a <code>file pointer</code> is updated when fwrite function have carried out?</p>
  
  <pre><code>&lt;?php
      $filename = "sample.txt";
      function edit($filename,$lineNo){
          $new_line = "Hello";
          $schedule_list = file($filename);
          $fp = fopen($filename,"w");
          foreach($schedule_list as $schedule_lineNo =&gt; $line){
              if($schedule_lineNo == $lineNo){
                  if($_POST["mode"] == "overwrite"){
                      fwrite($fp,$new_line);
                  }
                  elseif($_POST["mode"] == "delete"){
  
                  }
              else{
                  fwrite($fp,$line);
              }
          }
          fclose($fp);
      }
  ?&gt;
  </code></pre>