title: How to compare an array of list of keys with an array of "cat_name" of wordpress post with array_intersect
body: <p>i have created this code :</p>
  
  <pre><code> &lt;?php 
               $lisections = array('anglais','boxe-thai','Cyclotourisme','Danse-modernjazz–grs–classique','danse-sportive','dessin-peinture','escrime','Espagnol','gym-tonic','gymnastique-de-detente','gymnastique-enfantine-et-sportive','Gymnastique-senior','handball','hatha-yoga','histoire-de-lart','judo - ju jitsu','Karate','kendo-iaido','natation','ninjutsu','petanque','photo-club','randonnees-pedestres','refection-fauteuils','Sportives','subaquatique','tennis-de-table','tennis-de-table–senior','Tir','gym-dentretient-top-gym','sections-arts-martiaux','sections-langues','sections-gymnastique', 'section-aquatique','section-tennisdetable' );
              foreach((get_the_category()) as $cat) { 
                                  $displaycat[] = $cat-&gt;cat_name . ' '; 
               }
                //print_r($displaycat);
              $onesection=array_intersect($lisections,$displaycat);
              print_r($onesection);?&gt;
  </code></pre>
  
  <p>but it doesn't work.</p>
  
  <p>$displaycat display that : Array ( [0] => Accueil [1] => Evénements [2] => hatha-yoga [3] => Sections ).</p>
  
  <p>The result of print_r($onesection); is an empty array instead of Array([0] => hatha-yoga.</p>
  
  <p>My target is to get one of categories name "hatha-yoga" of one post to generate a link  to return to the main page of this section "hatha-yoga".</p>