Effectively dealing with x quantity $_POST vars
<p>I have a piece of code that I'm not happy with at all:</p>

<pre><code>// Search for checkboxes ('chk-1','chk-2','chk-3'...)
foreach ($_POST as $key =&gt; $val) {
    if (substr($key, 0,3) == 'chk') {  
        $appObj-&gt;cats[] = intval(substr($key,4,strlen($key)));
}
</code></pre>

<p>I really don't like this as $_POST can contain upwards of 40+ variables and I am already applying logic to all other posted vars.</p>

<p>Has anyone got any ideas / solutions to achieving the above without cycling through every $_POST var?</p>
