I want to turn a long string like something in the code like "reallyreallyre"; reallyreallyrelyrelyrelyrelylongfilename .. Yreallyreally .
Let Actually, Find the string until everything changed in the meantime does not occur, the length of the string & lt;
This is my code, where I have tried it:
function cut string ($ input, $ maxLen = 30) {if (stringin ($ input) & lt ; $ MaxLen) {return $ input; } $ Midpoint = floor (strlen (IN $ input) / 2); $ Startpoint = $ midpoint - 1; Return substr_replace ($ input, '...', $ startpoint, 3); }
It finds the center of the string and . > With the other one changes the character, but the thing is that I can not prepare it for cutting down 30 characters, or whatever is
$ maxLen
.
Hope you understand my question, I do not think I have done a great job by explaining it 8)
Thank you.
How about:
if (Strlen ($ input ) & gt; $ maxLen) {$ letter = floor ($ maxLen / 2); Return Upastrel ($ input, 0, $ characters) '...' Substr ($ input, -1 * $ characters); }
Comments
Post a Comment