In php we have to loop or any special thing to do this?
<pre><code>php&gt; $a = array("a"=&gt;1,"b"=&gt;0,"c"=&gt;1,"d"=&gt;1,"e"=&gt;0);

php&gt; $b = array();

php&gt; foreach ($a as $k =&gt;$v){
 ...   if($v != 0){
 ...     $b["$k"] = $v;
 ...   }
 ... }

php&gt; print_r($b);
Array
(
    [a] =&gt; 1
    [c] =&gt; 1
    [d] =&gt; 1
)

php&gt; 
</code></pre>

<p>Anyways to do it not using loop?</p>
