Using foreach to modify arrays starting with whitespace in php
<p>First time posting here, fresh into development.</p>

<p>Trying to modify the output of a text file with multiple lines, some start with characters, others with whitespace/tab. I want to have the lines that start with the tab/whitespace to be joined with any line that came directly before it. I've been looking into doing this with regex, but I'm not sure how to structure it. I'm thinking that I need to use 'foreach' to look at each line, find each one with whitespace, and use a series of regex to join them to the preceding line. This is how far I've gotten myself, along with where I <em>believe</em> the foreach should be at.</p>

<pre><code>&lt;?php

$file_handle = fopen("parse.txt", "r");

while (!feof($file_handle)){

    $each_line = fgets($file_handle);
    foreach ($each_line    ){

        }

    print $each_line . "&lt;br /&gt;";
}

fclose($file_handle);

?&gt;
</code></pre>

<p>The specific text file is at <a href="http://krondorkrew.com/parse/parse.txt" rel="nofollow">http://krondorkrew.com/parse/parse.txt</a>
If you go there and look at the index of the /parse folder, I have my current build of this php, also.</p>

<p>My next step is to separate each line into separate arrays by explode at the first : in each line, but I still want to try fighting that problem myself before looking to you awesome people for help (but if you have any insight, I wouldn't look away)</p>

<p>Thank you in advance for all help!</p>
