note 95428 added to function.sprintf

From: Date: Sun, 03 Jan 2010 01:27:24 +0000
Subject: note 95428 added to function.sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-164549@lists.php.net to get a copy of this message
The explanation on this page is incorrect Examples 3 and 4 are false %1$s is not valid, the correct syntax is %1\$s Examples corrected Example #3 Argument swapping <?php $format = 'The %2\$s contains %1\$d monkeys'; printf($format, $num, $location); ?> Example #4 Argument swapping <?php $format = 'The %\2$s contains %1\$d monkeys. That\'s a nice %2\$s full of %1\$d monkeys.'; printf($format, $num, $location); ?> ---- Server IP: 217.71.118.186 Probable Submitter: 213.219.182.218 ---- Manual Page -- http://www.php.net/manual/en/function.sprintf.php Edit -- https://master.php.net/note/edit/95428 Del: integrated -- https://master.php.net/note/delete/95428/integrated Del: useless -- https://master.php.net/note/delete/95428/useless Del: bad code -- https://master.php.net/note/delete/95428/bad+code Del: spam -- https://master.php.net/note/delete/95428/spam Del: non-english -- https://master.php.net/note/delete/95428/non-english Del: in docs -- https://master.php.net/note/delete/95428/in+docs Del: other reasons-- https://master.php.net/note/delete/95428 Reject -- https://master.php.net/note/reject/95428 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164549) next »