svn: /phpdoc/en/trunk/reference/strings/functions/ sprintf.xml

From: Date: Fri, 15 Jul 2011 09:27:13 +0000
Subject: svn: /phpdoc/en/trunk/reference/strings/functions/ sprintf.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8492@lists.php.net to get a copy of this message
salathe Fri, 15 Jul 2011 09:27:13 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=313261 Log: added example to sprintf of %n$ with other specifiers (thanks Steven) Changed paths: U phpdoc/en/trunk/reference/strings/functions/sprintf.xml Modified: phpdoc/en/trunk/reference/strings/functions/sprintf.xml =================================================================== --- phpdoc/en/trunk/reference/strings/functions/sprintf.xml 2011-07-15 08:40:55 UTC (rev 313260) +++ phpdoc/en/trunk/reference/strings/functions/sprintf.xml 2011-07-15 09:27:13 UTC (rev 313261) @@ -223,6 +223,29 @@ ]]> </programlisting> </example> + <para> + When using argument swapping, the <literal>n$</literal> + <emphasis>position specifier</emphasis> must come immediately + after the percent sign (<literal>%</literal>), before any other + specifiers, as shown in the example below. + </para> + <example> + <title>Position specifier with other specifiers</title> + <programlisting role="php"> +<![CDATA[ +<?php +$format= 'The %2$s contains %1$04d monkeys'; +printf($format, $num, $location); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +The tree contains 0005 monkeys +]]> + </screen> + </example> </para> </listitem> </varlistentry>

« previous php.doc.cvs (#8492) next »