title: How to get first x chars from a string, without cutting off the last word?
body: <p>I have the following string in a variable.</p>
  
  <pre>
  Stack Overflow is as frictionless and painless to use as we could make it.
  </pre>
  
  <p>I want to fetch first 28 characters from the above line, so normally if I use <a href="http://php.net/manual/en/function.substr.php" rel="noreferrer">substr</a> then it will give me <code>Stack Overflow is as frictio</code> this output but I want output as:</p>
  
  <pre>
  Stack Overflow is as...
  </pre>
  
  <p>Is there any pre-made function in PHP to do so, Or please provide me code for this in PHP?</p>
  
  <p><strong>Edited:</strong></p>
  
  <p>I want total 28 characters from the string without breaking a word, if it will return me few less characters than 28 without breaking a word, that's fine.</p>