Exploding an array

I pull this data from a database:


Some explanation goes here

<CODE>
echo ‘this is code’;
</CODE>

And then I continue the explanation here

I want to put this as an array, like this:
[0] = Some explanation goes here
[1] = <CODE>echo ‘this is code’;</CODE>
[2] = And then I continue the explanation here

I tried


$i=0;
$article = explode('

', $article);
foreach($article as $key => $value)
{
$array[$i] = $value;
$i++;
}



But it gives me this:

[0] = Some explanation goes here
[1] = &lt;CODE&gt;echo 'this is code';&lt;/CODE&gt;And then I continue the explanation here

How can I get the explanation chunks and the CODE chunks in array elements? I guess probably another explode, I have tried but can't make it work. 

I'm trying to do this because I want to apply htmlentities to the CODE chunks.

Note: I'm really using brackets instead of &lt; and &gt; but the forum would parse it as code.