title: PHP code for Substr - Making It Stop After A Word?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/972010/shorten-string-in-php-full-words-only">Shorten String in PHP (full words only)</a>  </p>
  </blockquote>
  
  
  
  <p>Below substr which iam using . Which echo first 38 characters from my database. This code breaking the word which is at end .</p>
  
  <pre><code>&lt;?php echo substr(ucfirst($row['metadesc']),0,38); ?&gt;...
  </code></pre>
  
  <p>which output like this.</p>
  
  <pre><code>news for today was null try tomo
  </code></pre>
  
  <p>how to stop the string after 38 characters after the end of word. </p>
  
  <p>output should be like this </p>
  
  <pre><code>news for today was null try tomorrow
  </code></pre>