note 40441 added to function.printf

From: Date: Wed, 03 Mar 2004 23:48:58 +0000
Subject: note 40441 added to function.printf
Groups: php.notes 
Request: Send a blank email to php-notes+get-66212@lists.php.net to get a copy of this message
In response to chris dot breen at accurate dot com : This will work, but i didn't try: <?php $format = 'The %2$s contains %1$d monkeys. That is a nice %2$s full of %1$d monkeys.'; printf($format, $num, $location); ?> Your problem came from the fact that in the string "\$s", the $ is simply escaped by the \, but but you must not do that with single quoted strings. Try to echo your strings to test it, or just go to http://www.php.net/manual/en/language.types.string.php ---- Manual Page -- http://www.php.net/manual/en/function.printf.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40441 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40441&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40441&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66212) next »