note 122609 deleted from function.mb-strimwidth by salathe

From: Date: Mon, 21 Sep 2020 14:57:17 +0000
Subject: note 122609 deleted from function.mb-strimwidth by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215386@lists.php.net to get a copy of this message
Note Submitter: felixstar4 at gmail dot com ---- Note that the trimmarker removes characters from the end of the string to trim, so $hello = 'Lorem ipsum dolor sit amet, lorem ipsum'; $trimmarker = '......................'; echo mb_strimwidth($hello, 0, 20, $trimmarker); will only add the values of the trim marker, as the character number of $trimmarker is longer than the specified value to trim to, so it will return: ...................... It is therefore better to use this: mb_strimwidth($hello, 0, 20). $trimmarker; as the trimmarker won't remove characters of the string in order to make space for itself. It will return: Lorem ipsum dolor si......................

« previous php.notes (#215386) next »