title: How do I create an associative array with this data and get its results?
body: <p>I have 1 field for each users which gives me a series of skills:</p>
  
  <pre><code>$user-&gt;user_description
  </code></pre>
  
  <blockquote>
    <p>User 1 =  Geography, English, Math, Science</p>
    
    <p>User 2 = English, Math, Geography</p>
    
    <p>User 3 = French, Math</p>
  </blockquote>
  
  <p><strong>NOTE</strong> 
  Each one is a phrase with comma separated strings</p>
  
  <p>Then I have another field for the gender which for each user I get:</p>
  
  <pre><code>get_user_meta( $the_user_id, $gender, $single ); 
  </code></pre>
  
  <blockquote>
    <p>User 1 =  Male</p>
    
    <p>User 2 = Female</p>
    
    <p>User 3 = Male</p>
  </blockquote>
  
  <p>The output I am looking for is:</p>
  
  <ul>
  <li>We have <strong>2 Math</strong> teachers with gender <strong>male</strong></li>
  <li>We have <strong>2 Geography</strong> teachers with gender <strong>male</strong> and <strong>female</strong></li>
  <li>We have <strong>1 French</strong> teacher with gender <strong>female</strong></li>
  <li>We have <strong>2 English</strong> teacher with gender <strong>male</strong> and <strong>female</strong></li>
  <li>We have <strong>1 Science</strong> teacher with gender <strong>male</strong></li>
  </ul>
  
  <p>This is how I loop the users:</p>
  
  <pre><code>$blogusers = get_users( 'orderby=nicename&amp;role=author' );
    foreach ( $blogusers as $user ) {
  </code></pre>
  
  <p><strong>NOTE</strong></p>
  
  <p>I tried to simplify on here but I went much further up with the code which I have it <a href="https://stackoverflow.com/questions/43347145/how-to-add-associative-array">in another question</a>. Any other info you may need I am ready to provide it, it is really getting me stack. The main bit which blocks me is how to associate the Gender together with each skills once these have been splitted and counted.</p>
  
  <p>What I have managed to do:</p>
  
  <ol>
  <li>Split the comma separated list and push them into an array</li>
  <li>Check for duplicated words in the array in order to be able to achieve the number of each skill e.g. 2 English</li>
  <li>Be able to have the tot. number of each gender</li>
  </ol>
  
  <p>But yet, not be able to add the gender for each skill once splitted</p>