note 43338 added to function.substr-replace
| From: | dmron at rn2 dot php dot net | Date: | Thu, 17 Jun 2004 20:34:10 +0000 |
| Subject: | note 43338 added to function.substr-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71258@lists.php.net to get a copy of this message | ||
Regarding "...", even the short functions are too long and complicated, and there's
no need to use substr_replace. substr() works better and is way faster prior to 4.3.5 as the below
poster stated.
function shorten( $str, $num = 100 ) {
if( strlen( $str ) > $num ) $str = substr( $str, 0, $num ) . "...";
return $str;
}
----
Manual Page -- http://www.php.net/manual/en/function.substr-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43338
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43338&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43338&report=yes
Search -- http://master.php.net/manage/user-notes.php