foreach array than search in other array
<p>Why this doesn't work? if (array_search((string)$key,$list))</p>

<pre><code>foreach ($head as $index =&gt; $key) 
        {
                if (array_search((string)$key,$list))
                {
                    $data[$index] = serialize($data[$index]);
                    $combined[$key] = isset($data[$index]) ? $data[$index] : null;
                } else {

                    $combined[$key] = isset($data[$index]) ? $data[$index] : null;
                }

        }  
</code></pre>

<p>$list is an array to search in</p>
