mb_strimwidth

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

mb_strimwidthGet truncated string with specified width

Beschreibung

mb_strimwidth(
    string $string,
    int $start,
    int $width,
    string $trim_marker = "",
    ?string $encoding = null
): string

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

Parameter-Liste

string

The string being decoded.

start

The 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. Negative widths count from the end of the string.

trim_marker

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

encoding

Der Parameter encoding legt das Zeichenencoding fest. Wird er nicht übergeben so wird die interne Zeichenkodierung genutzt.

Rückgabewerte

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

Changelog

Version Beschreibung
8.0.0 encoding ist nun nullable (akzeptiert den null-Wert).
7.1.0 Support for negative starts and widths has been added.

Beispiele

Beispiel #1 mb_strimwidth() example

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

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

How to Handle Older Console BIOS Files in Web Projects? Need Advice

Hello everyone, I have a question related to managing file handling and download structures in PHP. I am currently working on a small project whe ...

Geschrieben von maxhunter am 08.04.2026 12:06:28
Forum: Fragen/Vorschläge zum Forum
U4GM ARC Raiders Quest Guide: Outstanding Balance

"Outstanding Balance" is one of the newer side quests in ARC Raiders, added with the Flashpoint update and connected to Tian Wen's mission line. T ...

Geschrieben von 1fuhd am 07.04.2026 10:29:34
Forum: Off-Topic Diskussionen
U4GM Diablo 4: Lord of Hatred Launches April 28 with New Classes

Diablo 4's next expansion, Lord of Hatred, is set to launch on April 28, 2026, and early coverage suggests it could be one of the most significant ...

Geschrieben von 1fuhd am 07.04.2026 10:28:45
Forum: Off-Topic Diskussionen
Usertreffen in Berlin am 20.2.2010

Basant Club (https://basantclubdownload.com.pk/) is a popular app in Pakistan to earn money. Download Basantclub and play games and earn a lot of ...

Geschrieben von basantclub am 07.04.2026 08:47:29
Forum: Ankündigungen