title: Is there a way that I can use sprintf() to limit a line/field size?
body: <p>I wrote the following bit of code and was wondering if there is a way that I can limit a field's size so that it doesn't overflow outside of the bounds of the line and wrap around into a new line.?</p>
  
  <pre><code>echo "Category    Product Selected" . "\n";
  echo "-------------------------------------------------------------------------"."\n";
  foreach ($category_page as $key =&gt; $value) {
      echo sprintf("%8s    %s",$key,$value) . "\n";
  }
  </code></pre>
  
  <p>Bear in mind that this is being formatted for a plain text email/file.</p>