note 19015 added to function.substr-replace
| From: | klaas at group94 dot com | Date: | Wed, 13 Feb 2002 15:38:37 +0000 |
| Subject: | note 19015 added to function.substr-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26552@lists.php.net to get a copy of this message | ||
THE DOT DOT DOT ISSUE
PROBLEM:
You want to abbreviate a string.
E.g. You want "BritneySpears" to show as "BritneySpe...", being only the ten
first characters followed by "..."
SOLUTION:
<?
$oRIGINAL = "BritneySpears";
$sHORTER = substr_replace($oRIGINAL, '...', 10);
echo ($sHORTER);
?>
This will result in BritneySpe...
--
http://www.php.net/manual/en/function.substr-replace.php
http://master.php.net/manage/user-notes.php?action=edit+19015
http://master.php.net/manage/user-notes.php?action=delete+19015
http://master.php.net/manage/user-notes.php?action=reject+19015