/ Published in: PHP
Took from http://www.milesj.me/blog/read/15/5-custom-basic-php-string-functions
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * If a string is too long, shorten it in the middle * @param string $text * @param int $limit * @return string */ function shorten($text, $limit = 25) { $text = $pre .' ... '. $suf; } return $text; }
URL: http://www.milesj.me/blog/read/15/5-custom-basic-php-string-functions