title: Shorten string with a "..." body
body: <p>Just like the the iPhone's app names that run to long, the name gets shortened. I really like  this method of shorting a name or a string rather then appending a "..." clause to it. Sorry if I am being confusing, I'm having trouble explaining what I am trying to do. So I'll show an example!</p>
  
  <p>This is what I have, to append "..." to a shortened string (In PHP)</p>
  
  <pre><code>&lt;?php
    $string = "This is a test script";
  
    if (strlen($string) &gt;= 14)
      echo(substr($string), 0, 13). "..."); // This is a test...
    else
      echo($string); // This is a test script
  ?&gt;
  </code></pre>
  
  <p>I would like to split up the name or string and keep the first say 10 characters, then insert "..." in the middle and lastly take the ending 5 letters of the string and display them. I was thinking of something along the lines of:</p>
  
  <pre><code>&lt;?php
    $string = "This is a test script";
  
    if (strlen($string) &gt;= 20)
      echo(substr($string, 0, 10). "..." .substr($string, 15, 20)); //This is a ...script
    else
      echo($string);
  ?&gt;
  </code></pre>
  
  <p>But realize that will not work in the regards that there are more then just 5 letters in the end. Any pointers into the write direction would be great, Thanks!</p>