PHP Explode Words
<p>I'm new in PHP programming. I need your help to finish my homework.</p>

<p>I want to explode the following sentence: <strong>I love my band and my cat</strong> into arrays.</p>

<p>But I need to use <strong>space</strong> and word <strong>and</strong> as delimiters. So it should become like this:</p>

<pre><code>$arr[0] -&gt; I
$arr[1] -&gt; love
$arr[2] -&gt; my
$arr[3] -&gt; band
$arr[4] -&gt; my
$arr[5] -&gt; cat
</code></pre>

<p>I have tried like this:</p>

<pre><code>$words = "I love my band and my cat"
$stopwords = "/ |and/";
$arr = explode($stopwords, $words);
</code></pre>

<p>But the problem is, it also removes characters <strong>and</strong> from word <strong>band</strong> so it becomes like this:</p>

<pre><code>$arr[0] -&gt; I
$arr[1] -&gt; love
$arr[2] -&gt; my
$arr[3] -&gt; b
$arr[4] -&gt; my
$arr[5] -&gt; cat
</code></pre>

<p>This is not what I want. I want to remove the word that exactly <strong>and</strong>, not word that contains <strong>and</strong> characters.</p>

<p>Is there anyway to solve this? Can anybody help me? Thank you very much.. :-)</p>
