PHP - how can I stop a function from printing an extra || at the end?
<p>In PHP I have a function, the problem is it will output an extra || at the end that I dont want.</p>

<pre><code>&lt;script type="text/javascript"&gt;
function hide_card_code() {
  var payment_source=document.getElementById('payment_source');
  if(
    &lt;?
    forEach($result_cards as $key =&gt; $value) {
      echo "payment_source.value=='$value' || \n";
    }
    ?&gt;
    ) {
    //do stuff...
    return true;
  }
}
&lt;/script&gt;
</code></pre>

<p>It will output the following HTML.  Note the extra || at the end.</p>

<pre><code>&lt;script type="text/javascript"&gt;
function hide_card_code() {
  var payment_source=document.getElementById('payment_source');
  if(
    payment_source.value=='23' || 
    payment_source.value=='24' || 
    payment_source.value=='25' || 
    ) {
    //do stuff...
    return true;
  }
}
&lt;/script&gt;
</code></pre>

<p>How do I stop that extra || ?</p>
