php - Shorten string with a "..." body -


Just like the name of the iPhone App, which runs for long, the name decreases. I actually have a name Or I like this method of shrinking a string, but add "..." section to it. If I am getting confused, then sorry, I am being understood what I am trying to do. So I will show an example!

I have it, "..." in a small string (in PHP)

  & lt; Php $ String = "This is a test script"; If (strollon ($ string)> = 14) echo (substr ($ string), 0, 13). "..."); // This is a test ... and echo ($ string); // Is this a test script? & Gt;  

I would like to split the name or string and keep the first letter in 10 characters, then insert "..." in the middle and end the 5 letters of the string at the end and Display I was thinking on the lines of this:

   = 20) echo (substr ($ string, 0, 10). "..." .substr ($ string, 15, 20)); // This is a ... script and echo ($ string); ? & Gt;  

But know that it will not work in this regard that in the end there are only 5 letters. Any sign will be great in writing, thanks!

  if (string ($ string)) & gt; = 20) {echo substr ($ string, 0, 10). "...". Substr ($ string, -5); } Else {echo $ string; }  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -