using variables in other variables name - PHP
<p>See this:</p>

<pre><code>        $q = 'blah';
        for($k = 0; $k &lt; count($results_array); $k++){
            $results_array_ . $k = explode(',', $results_array[$k]);
            foreach($results_array_ . $k as $key =&gt; $value){
                if (stripos($value, $q) === false) {
                unset($results_array_ . $k[$key]);
                break;
                }
            }
        }
</code></pre>

<p>On line 3 I'm simply using "$results_array_ . <strong>$k</strong>" and it's working just fine, but on line 6 I'm getting PHP parse errors on "unset($results_array_ . <strong>$k</strong>[$key])", why is this happening?</p>

<p>I appreciate anykind of help</p>

<hr>

<p>Why I'm doing it:</p>

<p>I have an array named results_array:</p>

<pre><code>var_dump($results_array):
0 =&gt; php,mysql,jquery,ruby,html,css,lamp
1 =&gt; mouse,keyboard,laptop,pad
2 =&gt; table,sofa,caption
</code></pre>

<p>and I have a $q which stands for query, I want to search in the $results_array and remove the items which has nothing to do with the query, so if I set <strong>$q=a</strong> then results array should be this:</p>

<pre><code>0 =&gt; lamp
1 =&gt; keyboard,laptop,pad
3 =&gt; table,sofa,caption
</code></pre>

<p>now, I want to put the above results in each index of the results_array, at the end results_array should be:</p>

<pre><code>0 =&gt; lamp
1 =&gt; keyboard
2 =&gt; laptop
3 =&gt; pad
4 =&gt; table
5 =&gt; sofa
6 =&gt; caption
</code></pre>
