title: Simple PHP function to remove the last line from text file not working
body: <p>I have a text file named <code>test</code> with only 2 lines:</p>
  
  <pre><code>1
  2
  </code></pre>
  
  <p>I want to be able to remove the last line from the file so I use the following function:</p>
  
  <pre><code>&lt;?php
  
  $file = file('test.txt');
  array_pop($file);
  file_put_contents(implode($file));
  
  ?&gt;
  </code></pre>
  
  <p>For some reason, this does nothing and the file still has the exact lines..am I missing something here?</p>