take specific data from a list in php
<p>I have a string like this: </p>

<pre><code> house1- a normal house 

 house2-an office  

 house3-a scholl 
</code></pre>

<p>There are about 2000 lines. I want to get only house1,house2,house3 etc. from that it and put it in another file. Like:</p>

<pre><code> house1

 house2 

 house3
</code></pre>

<p>I understand that the explode function works for separating strings, but how can I do this? </p>
