remove text before and after the text i want - PHP
<p>here is my example text</p>

<pre><code>------=_Part_564200_22135560.1319730112436
Content-Type: text/plain; charset=utf-8; name=text_0.txt
Content-Transfer-Encoding: 7bit
Content-ID: &lt;314&gt;
Content-Location: text_0.txt
Content-Disposition: inline

I hate u
------=_Part_564200_22135560.1319730112436
Content-Type: image/gif; name=dottedline350.gif
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=dottedline350.gif
Content-ID: &lt;dottedline350.gif&gt;
</code></pre>

<p>I need to be able to extract the "I hate u".</p>

<p>I know i can use explode to remove the last part after the message by doing</p>

<pre><code>$body_content = garbled crap above;
$message_short = explode("------=_",$body_content);
echo $message_short;
</code></pre>

<p>but i need to remove the first part, along with the last part. </p>

<p>So, explode function above does what I need to remove the end
now i need something that says</p>

<p>FIND 'Content-Disposition: inline' and remove along with anything before
then
FIND '------=_' and remove along with anything after
then
Anything remaining = $message_short</p>

<p>echo $message_short;</p>

<p>will look like</p>

<p>I hate u</p>

<p>Any help would be appreciated.</p>

<hr>

<p>Thanks @Marcus</p>

<p>This is the code i now have and works wonderfully.</p>

<pre><code>$body_content2 = imap_qprint(imap_body($gminbox, $email_number));
$body_content2 = strip_tags ($body_content2);    
$tmobile_body = explode("------=_", $body_content2);
$tmobile_body_short = explode("Content-Disposition: inline", $tmobile_body[1]);
$tmobile_body_complete1 = trim($tmobile_body_short[1]);
$tmobile_body_complete2 = explode("T-Mobile", $tmobile_body_complete1);
$tmobile_body_complete3 = trim($tmobile_body_complete2[1]);
</code></pre>
