dave Tue Aug 10 21:50:46 2004 EDT
Modified files:
/phpdoc/en/reference/strings/functions sprintf.xml
Log:
- Document sign specifier.
http://cvs.php.net/diff.php/phpdoc/en/reference/strings/functions/sprintf.xml?r1=1.12&r2=1.13&ty=u
Index: phpdoc/en/reference/strings/functions/sprintf.xml
diff -u phpdoc/en/reference/strings/functions/sprintf.xml:1.12
phpdoc/en/reference/strings/functions/sprintf.xml:1.13
--- phpdoc/en/reference/strings/functions/sprintf.xml:1.12 Sat Aug 7 21:30:40
2004
+++ phpdoc/en/reference/strings/functions/sprintf.xml Tue Aug 10 21:50:46 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.12 $ -->
+<!-- $Revision: 1.13 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.sprintf">
<refnamediv>
@@ -33,6 +33,15 @@
<orderedlist>
<listitem>
<simpara>
+ An optional <emphasis>sign specifier</emphasis> that forces a sign
+ (- or +) to be used on a number. By default, only the - sign is used
+ on a number if it's negative. This modifier forces positive numbers
+ to have the + sign attached as well. This specifier was added in
+ PHP 4.3.0.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
An optional <emphasis>padding specifier</emphasis> that says
what character will be used for padding the results to the
right string size. This may be a space character or a
@@ -97,7 +106,7 @@
</member>
<member>
<literal>f</literal> - the argument is treated as a
- <type>float</type>, and presented as a floating-point number.
+ float, and presented as a floating-point number.
</member>
<member>
<literal>o</literal> - the argument is treated as an
@@ -212,6 +221,9 @@
printf("%%s = '%s'\n", $n); // string representation
printf("%%x = '%x'\n", $n); // hexadecimal representation (lower-case)
printf("%%X = '%X'\n", $n); // hexadecimal representation (upper-case)
+
+printf("%%+d = '%+d'\n", $n); // sign specifier on a positive integer
+printf("%%+d = '%+d'\n", $u); // sign specifier on a negative integer
?>
]]>
</programlisting>
@@ -231,6 +243,8 @@
%s = '43951789'
%x = '29ea6ad'
%X = '29EA6AD'
+%+d = '+43951789'
+%+d = '-43951789'
]]>
</screen>
</example>