mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Document sign specifier.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@165990 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
7f512d7f60
commit
a5186260fe
1 changed files with 16 additions and 2 deletions
|
@ -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>
|
||||
|
@ -31,6 +31,15 @@
|
|||
(<literal>%</literal>), followed by one or more of these
|
||||
elements, in order:
|
||||
<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
|
||||
|
@ -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("%%o = '%o'\n", $n); // octal representation
|
|||
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 @@ printf("%%X = '%X'\n", $n); // hexadecimal representation (upper-case)
|
|||
%s = '43951789'
|
||||
%x = '29ea6ad'
|
||||
%X = '29EA6AD'
|
||||
%+d = '+43951789'
|
||||
%+d = '-43951789'
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
|
Loading…
Reference in a new issue