title: How to add string if two arrays are in php?
body: <p>I have array values if there are two values i need to add a string &quot;AND&quot; if single value &quot;AND&quot; string should not be added. i have tried with the following code. cant get the required output</p>
  <pre><code>$unserialize_meta = array(0=&gt;&quot;Alcor&quot;,1=&gt;&quot;President&quot;,2=&gt;&quot;Treasurer&quot;);
  $checks = array();
  foreach($unserialize_meta as $meta){
      $checks[]= $meta;
  }
  
  echo implode(&quot; And &quot;,$checks);
  
  Output:
  
  Alcor And President
  Alcor And President And
  
  required output:
  Alcor And President
  Alcor And President 
  </code></pre>