note 85325 deleted from function.mb-strimwidth by mgf

From: Date: Wed, 27 Aug 2008 12:40:31 +0000
Subject: note 85325 deleted from function.mb-strimwidth by mgf
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-143872@lists.php.net to get a copy of this message
Note Submitter: CBieser ---- 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; }

« previous php.notes (#143872) next »