Filtering values against an expression and a list
<p>I'm writing a bot for the IMified network.</p>

<p>I want to filter the items processed by my bot by only accepting certain values into my script.</p>

<p>This is what I'm using right now:</p>

<pre><code>$items = array('botkey', 'userkey', 'network', 'user', 'channel', 'msg', 'step');

foreach ($_POST as $key =&gt; $value)
{
    if (in_array($key, $items) || preg_match('value\d*', $key))
    {
     $this-&gt;data[$key] = $value;
    }
}
</code></pre>

<ol>
<li>Is there any way to do this better?</li>
<li>Why doesn't my regular expression work – it is meant to only allow keys named like <code>value1234</code> or anything similar ("value" + number), but it doesn't let <em>anything</em> through.</li>
</ol>
