Array counting Error <p>I am trying to count from the following associative array in two's key->value filter, by Key-gender and Key-rname, Please see below ...</p> <pre><code>&lt;pre&gt; Array ( [0] =&gt; Array ( [fname] =&gt; jone [lname] =&gt; jani [gender] =&gt; m [rname] =&gt; N ) [1] =&gt; Array ( [fname] =&gt; jani [lname] =&gt; jone [gender] =&gt; m [rname] =&gt; N ) [2] =&gt; Array ( [fname] =&gt; sara [lname] =&gt; bulbula [gender] =&gt; w [rname] =&gt; D ) [3] =&gt; Array ( [fname] =&gt; hani [lname] =&gt; hanu [gender] =&gt; w [rname] =&gt; P ) [4] =&gt; Array ( [fname] =&gt; ttttttt [lname] =&gt; sssssss [gender] =&gt; m [rname] =&gt; C ) ) &lt;/pre&gt; </code></pre> <p>What i want the result is as follows..</p> <pre> rname gender m w N 2 0 D 0 1 P 0 1 C 1 0 total 3 2 </pre> <p>Some help please? </p>