Stripping Comments out of a file in PHP
<p>I have to parse various files that contain comments of differing types.  I have been trying to figure an easy way to strip out these comments, but nothing good so far.  I have full line comments that start with both # and ; and comments that start after relevant data.  Best example:</p>

<pre><code>data
data
#comment
;comment
data ;comment
data #comment
</code></pre>

<p>Any help in stripping these comments?  And perhaps blank lines as well?</p>
