PHP.nl

mb_strimwidth

mb_strimwidth

Get truncated string with specified width

string **mb_strimwidth** string $string int $start int $width string $trim_marker  $encoding

Truncates to specified , where halfwidth characters count as , and fullwidth characters count as . See for details regarding East Asian character widths. string``string``width``1``2url.unicode.reports.tr11/

string The being decoded. string

startThe start position offset. Number of characters from the beginning of string (first character is 0), or if start is negative, number of characters from the end of the string.

width The width of the desired trim. If negative width is specified, count from the end of the string.

  > **Opmerking:** > Passing negative width is deprecated as of PHP 8.3.0.

trim_markerA string that is added to the end of string when string is truncated.

encoding

The truncated . If is set, replaces the last chars to match the . string``trim_marker``trim_marker``width

Voorbeeld: example

<?php
echo mb_strimwidth("Hello World", 0, 10, "...");
// output: "Hello W..."
?>

mb_strwidth``mb_internal_encoding