note 85325 added to function.mb-strimwidth
| From: | CBieser at osu1 dot php dot net | Date: | Tue, 26 Aug 2008 07:46:19 +0000 |
| Subject: | note 85325 added to function.mb-strimwidth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143824@lists.php.net to get a copy of this message | ||
function strimwidthCenter( $value, $lenght = 40 ) {
$valueEncoding = mb_detect_encoding( $value, 'auto', true );
if ( $lenght >= mb_strwidth( $value, $valueEncoding ) ) {
return $value;
}
$limited = '';
$firstWidth = ceil( $lenght/2 );
$secondStart = mb_strwidth( $value, $valueEncoding ) - ( $lenght - $first );
$secondWidth = $lenght - $first;
$limited = mb_strimwidth( $value, 0, $firstWidth, '...', $valueEncoding ) . mb_substr(
$value, $secondStart, $secondWidth+1, $valueEncoding );
return $limited;
}
----
Server IP: 212.124.37.9
Probable Submitter: 217.91.50.22
----
Manual Page -- http://www.php.net/manual/en/function.mb-strimwidth.php
Edit -- https://master.php.net/note/edit/85325
Del: integrated -- https://master.php.net/note/delete/85325/integrated
Del: useless -- https://master.php.net/note/delete/85325/useless
Del: bad code -- https://master.php.net/note/delete/85325/bad+code
Del: spam -- https://master.php.net/note/delete/85325/spam
Del: non-english -- https://master.php.net/note/delete/85325/non-english
Del: in docs -- https://master.php.net/note/delete/85325/in+docs
Del: other reasons-- https://master.php.net/note/delete/85325
Reject -- https://master.php.net/note/reject/85325
Search -- https://master.php.net/manage/user-notes.php