title: how to remove last char from string
body: <p>It might be a simple task. But I am new to PHP.</p>
  
  <p>I am creating a string of values getting from database for a specific purpose.</p>
  
  <p>How to remove last char from string.</p>
  
  <pre><code>$str='';
  foreach($dataarray as $value)
  {
     $str.=$value."##";
   }
  </code></pre>
  
  <p>it gives me string like <code>ABC##DEF##GHI##</code></p>
  
  <p>I have to remove last  2 chars <code>##</code></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>have shown here sample code . actull y array is 2D. so cant use <code>implode()</code></p>