title: Cutting a string in PHP
body: <p>I have a string.  Sometimes it is longer than 50 characters, sometimes shorter.  If it is longer I want to cut it to 50 (or the nearest '.' after 50 characters if possible.</p>
  
  <p>I currently use <code>strlen</code> to check, then copy each character into a new string using the strings array until I reach 50 (in a for loop).  This seems like a bad way to do it and slow.  I have no way to do the up to '.' part so far...</p>
  
  <ul>
  <li>Is their a better way to cut the string?</li>
  <li>How can one do the '.' part?</li>
  </ul>