title: How to compare two arrays and see if they have anything in common(PHP)
body: <p>I need to compare two arrays and pass variable values according to the result.
  I loop $additionalTestsAvailable, if $additionalTestsSelected has a value in $additionalTestsSelected, passing 'Yes' to additionalTestsSelected, else passing ''. But the result are all ''. It shouldn't like this. Anything wrong with my code?</p>
  
  <pre><code>$additionalTestsSelected = $appointmentTime-&gt;getAdditionalTestsSelected();
  $additionalTestsAvailable = $appointmentTime-&gt;getAdditionalTestsAvailable();
  
  foreach($additionalTestsAvailable as $test) {
  
      if(in_array($test,$additionalTestsSelected)){
        $additionalTests[$test-&gt;getName()] = 'Yes';
      }else{
        $additionalTests[$test-&gt;getName()] = '';
      }
  }
  </code></pre>