MessageFormatter::format

msgfmt_format

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

MessageFormatter::format -- msgfmt_formatFormat the message

Beschreibung

Objektorientierter Stil

public MessageFormatter::format(array $values): string|false

Prozeduraler Stil

msgfmt_format(MessageFormatter $formatter, array $values): string|false

Format the message by substituting the data into the format string according to the locale rules

Parameter-Liste

formatter

The message formatter

values

Arguments to insert into the format string

Rückgabewerte

The formatted string, or false if an error occurred

Beispiele

Beispiel #1 msgfmt_format() example

<?php
$fmt 
msgfmt_create("en_US""{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree");
echo 
msgfmt_format($fmt, array(45601234560/123));
$fmt msgfmt_create("de""{0,number,integer} Affen auf {1,number,integer} Bäumen sind {2,number} Affen pro Baum");
echo 
msgfmt_format($fmt, array(45601234560/123));
?>

Beispiel #2 OO example

<?php
$fmt 
= new MessageFormatter("en_US""{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree");
echo 
$fmt->format(array(45601234560/123));
$fmt = new MessageFormatter("de""{0,number,integer} Affen auf {1,number,integer} Bäumen sind {2,number} Affen pro Baum");
echo 
$fmt->format(array(45601234560/123));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

4,560 monkeys on 123 trees make 37.073 monkeys per tree
4.560 Affen auf 123 Bäumen sind 37,073 Affen pro Baum

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

UK+27788517840 The Most Powerful Lottery Spells Caster In North Las Vegas, California

Luck and strategy aren’t the only ways for you to win your gamble. Cast a spell on your wager and attract luck in your favor with these fortune ...

Geschrieben von Psychicmartha am 29.06.2026 18:17:26
Forum: Fragen/Vorschläge zum Forum
+27788517840 Turn Back Time Spell in Philadelphia–Time Travel Spells Caster in Avalon

Do you wish you could go back and change a critical moment in your past? Do you feel like a specific decision altered your life path, and you are ...

Geschrieben von Psychicmartha am 29.06.2026 18:15:07
Forum: Fragen/Vorschläge zum Forum
+27788517840 Rewind Time Spells That Work Using Magic Time Machine To Fix My Past.

We always don’t make things right when it is needed. If you have made some bad choices in the past, it is more likely that you are facing the co ...

Geschrieben von Psychicmartha am 29.06.2026 18:01:47
Forum: Fragen/Vorschläge zum Forum
Philadelphia +27788517840 Time Travel Spells To Fix Past Mistakes In Es************ Fells.

We always don’t make things right when it is needed. If you have made some bad choices in the past, it is more likely that you are facing the co ...

Geschrieben von Psychicmartha am 29.06.2026 17:59:39
Forum: Fragen/Vorschläge zum Forum