note 126223 added to messageformatter.formatmessage

From: Date: Tue, 06 Jul 2021 21:31:39 +0000
Subject: note 126223 added to messageformatter.formatmessage
Groups: php.notes 
Request: Send a blank email to php-notes+get-216583@lists.php.net to get a copy of this message
Although not mentioned, single quotes (') are used internally as escaping characters. So if you want to have them in your output, you should escape them with another single quote. See examples below. <?php // The value {foo} should be enclosed in single quotes echo msgfmt_format_message('en_US', "The value '{foo}' should be enclosed in single quotes", ['foo' => 'bar']); // The value 'bar' should be enclosed in single quotes echo msgfmt_format_message('en_US', "The value ''{foo}'' should be enclosed in single quotes", ['foo' => 'bar']); ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 2806:1000:8102:9101:45c7:e647:7ff3:5f00) ---- Manual Page -- https://php.net/manual/en/messageformatter.formatmessage.php Edit -- https://main.php.net/note/edit/126223 Del: integrated -- https://main.php.net/note/delete/126223/integrated Del: useless -- https://main.php.net/note/delete/126223/useless Del: bad code -- https://main.php.net/note/delete/126223/bad+code Del: spam -- https://main.php.net/note/delete/126223/spam Del: non-english -- https://main.php.net/note/delete/126223/non-english Del: in docs -- https://main.php.net/note/delete/126223/in+docs Del: other reasons-- https://main.php.net/note/delete/126223 Reject -- https://main.php.net/note/reject/126223 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216583) next »