note 97281 added to function.sprintf
| From: | kamm at osu1 dot php dot net | Date: | Mon, 12 Apr 2010 10:41:58 +0000 |
| Subject: | note 97281 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168149@lists.php.net to get a copy of this message | ||
Argument swapping doesn't work with heredoc
<?php
$num = 5;
$location = 'jungle';
$format1 = 'The %2$s contains %1$d monkeys';
$format2 = <<<EOD
The %s contains %d monkeys
EOD;
$format3 = <<<EOD
The %2$s contains %1$d monkeys
EOD;
echo sprintf($format1, $num, $location); // OK
echo sprintf($format2, $location, $num); // OK
echo sprintf($format3, $num, $location ); // Doesn't work
?>
----
Server IP: 69.147.83.197
Probable Submitter: 94.76.168.219
----
Manual Page -- http://www.php.net/manual/en/function.sprintf.php
Edit -- https://master.php.net/note/edit/97281
Del: integrated -- https://master.php.net/note/delete/97281/integrated
Del: useless -- https://master.php.net/note/delete/97281/useless
Del: bad code -- https://master.php.net/note/delete/97281/bad+code
Del: spam -- https://master.php.net/note/delete/97281/spam
Del: non-english -- https://master.php.net/note/delete/97281/non-english
Del: in docs -- https://master.php.net/note/delete/97281/in+docs
Del: other reasons-- https://master.php.net/note/delete/97281
Reject -- https://master.php.net/note/reject/97281
Search -- https://master.php.net/manage/user-notes.php