note 84585 added to function.sprintf
| From: | luhres at osu1 dot php dot net | Date: | Sun, 20 Jul 2008 16:54:07 +0000 |
| Subject: | note 84585 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-142204@lists.php.net to get a copy of this message | ||
I like the placeholders $ option. But what doesn't seem to work is if you use it in a define();
For example this works:
define( HOME_TEXT, "Hello %s and welcome to %s" );
but not this
define( HOME_TEXT, "Hello $1%s and welcome to $2%s" );
This would be great to separate text from code and decouple as much as possbile.
You could replace the above by
define( HOME_TEXT, "You are in $2%s: welcome $1%s" );
without touching the code.
Any ideas?
----
Server IP: 195.26.5.11
Probable Submitter: 83.99.53.244
----
Manual Page -- http://www.php.net/manual/en/function.sprintf.php
Edit -- https://master.php.net/note/edit/84585
Del: integrated -- https://master.php.net/note/delete/84585/integrated
Del: useless -- https://master.php.net/note/delete/84585/useless
Del: bad code -- https://master.php.net/note/delete/84585/bad+code
Del: spam -- https://master.php.net/note/delete/84585/spam
Del: non-english -- https://master.php.net/note/delete/84585/non-english
Del: in docs -- https://master.php.net/note/delete/84585/in+docs
Del: other reasons-- https://master.php.net/note/delete/84585
Reject -- https://master.php.net/note/reject/84585
Search -- https://master.php.net/manage/user-notes.php