mb_detect_order

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

mb_detect_orderSet/Get character encoding detection order

Beschreibung

mb_detect_order(array|string|null $encoding = null): array|bool

Sets the automatic character encoding detection order to encoding.

Parameter-Liste

encoding

encoding is an array or comma separated list of character encoding. See supported encodings.

If encoding is omitted or null, it returns the current character encoding detection order as array.

This setting affects mb_detect_encoding() and mb_send_mail().

mbstring currently implements the following encoding detection filters. If there is an invalid byte sequence for the following encodings, encoding detection will fail.

UTF-8, UTF-7, ASCII, EUC-JP,SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP

For ISO-8859-*, mbstring always detects as ISO-8859-*.

For UTF-16, UTF-32, UCS2 and UCS4, encoding detection will fail always.

Rückgabewerte

When setting the encoding detection order, true is returned on success or false on failure.

When getting the encoding detection order, an ordered array of the encodings is returned.

Changelog

Version Beschreibung
8.0.0 encoding ist nun nullable (akzeptiert den null-Wert).

Beispiele

Beispiel #1 mb_detect_order() examples

<?php
/* Set detection order by enumerated list */
mb_detect_order("eucjp-win,sjis-win,UTF-8");

/* Set detection order by array */
$ary[] = "ASCII";
$ary[] = "JIS";
$ary[] = "EUC-JP";
mb_detect_order($ary);

/* Display current detection order */
echo implode(", "mb_detect_order());
?>

Beispiel #2 Example showing useless detect orders

; Always detect as ISO-8859-1
detect_order = ISO-8859-1, UTF-8

; Always detect as UTF-8, since ASCII/UTF-7 values are 
; valid for UTF-8
detect_order = UTF-8, ASCII, UTF-7

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

Komisches Problem (bei SQL-Inserts) - keine Fehlermeldung

A strange problem with SQL inserts can be frustrating, especially when there are no clear error messages to point to the cause. Careful debugging ...

Geschrieben von samueleasley71 am 03.06.2026 13:03:06
Forum: PHP Developer Forum
RSgoldfast RuneScape: Secrets of Amberfell Boss Fight and Vampyre Battle Guide

The latest RuneScape 3 members quest, Secrets of Amberfell, has officially arrived, continuing the ongoing battle against the growing Sanguine thr ...

Geschrieben von Lilidala am 03.06.2026 10:25:34
Forum: Fragen/Vorschläge zum Forum
MMOexp Path of Exile: Why Elder-Shaper Weapons Are Endgame Essentials

For many high-end Path of Exile builds, especially popular SSF Bob-style setups, one item appears again and POE orbs (https://www.mmoexp.com/Path- ...

Geschrieben von Lilidala am 03.06.2026 10:24:59
Forum: Fragen/Vorschläge zum Forum
MMOexp FC 26: What Makes This Meta Shooting Technique So Reliable

Scoring chances is only half the battle in FC 26. Converting those opportunities into goals consistently is what FIFA 26 Coins (https://www.mmoexp ...

Geschrieben von Lilidala am 03.06.2026 10:24:16
Forum: Fragen/Vorschläge zum Forum