PHP: Is there a command that can delete the contents of a file without opening it?
<p>Is there any way to remove the contents of an file in php, do we have any php command that does that, I know <code>unlink</code> but I do not want to delete the file instead I just want to remove the contents of that file. </p>

<p>I have an file which I pass while called a <code>getCurrentDBSnap</code> function, it takes in the file from <code>/home/test/incoming</code> folder and populates currentDB table state into the file using <code>fputcsv</code> and puts back file to <code>/home/test/outgoing</code>. </p>

<p>Currently file stays in incoming folder and when I can call the function <code>getCurrentDBSnap</code> it would take the file and override with latest state of DB into it. </p>

<p><strong>Q:</strong> My question is, is it possible instead of overwriting the file, we can remove the content of file after ever <code>getCurrentDBSnap</code> such that file in incoming folder would be always empty ?</p>

<p>Hope it makes sense :)</p>
