cvs: phpdoc-pl /reference/strings/functions number-format.xml
| From: | Adam Major | Date: | Sun, 28 Jan 2007 12:07:21 +0000 |
| Subject: | cvs: phpdoc-pl /reference/strings/functions number-format.xml | ||
| Groups: | php.doc.pl | ||
| Request: | Send a blank email to doc-pl+get-1018@lists.php.net to get a copy of this message | ||
adi Sun Jan 28 12:07:21 2007 UTC
Added files:
/phpdoc-pl/reference/strings/functions number-format.xml
Log:
[joeaccord] New file
http://cvs.php.net/viewvc.cgi/phpdoc-pl/reference/strings/functions/number-format.xml?view=markup&rev=1.1
Index: phpdoc-pl/reference/strings/functions/number-format.xml
+++ phpdoc-pl/reference/strings/functions/number-format.xml
<?xml version="1.0" encoding="iso-8859-2"?>
<!-- EN-Revision: 1.9 Maintainer: qrak Status: ready -->
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/math.xml, last change in rev 1.2 -->
<refentry id="function.number-format">
<refnamediv>
<refname>number_format</refname>
<refpurpose>Formatuje liczbê wed³ug szablonu</refpurpose>
</refnamediv>
<refsect1>
<title>Opis</title>
<methodsynopsis>
<type>string</type><methodname>number_format</methodname>
<methodparam><type>float</type><parameter>liczba</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>miejsc_dziesiêtnych</parameter></methodparam>
<methodparam
choice="opt"><type>string</type><parameter>przecinek_dziesiêtny</parameter></methodparam>
<methodparam><type>string</type><parameter>separator_tysiêcy</parameter></methodparam>
</methodsynopsis>
<para>
Funkcja <function>number_format</function> zwraca sformatowan± liczbê
<parameter>liczba</parameter> wed³ug podanych argumentów. Ta funkcja
przyjmuje jeden, dwa lub cztery argumenty (nie trzy):
</para>
<para>
Je¶li podany jest tylko jeden argument, <parameter>liczba</parameter>
zostanie sformatowana bez miejsc dziesiêtnych ale z przecinkiem (",")
pomiêdzy ka¿d± grup± tysiêcy.
</para>
<para>
Je¶li podane s± dwa argumenty, <parameter>liczba</parameter> bêdzie
sformatowana z <parameter>miejsc_dziesiêtnych</parameter>, z kropk±
(".") w charakterze przecinka dziesiêtnego i przecinkiem (",")
pomiêdzy ka¿d± grup± tysiêcy.
</para>
<para>
Kiedy wszystkie cztery parametry s± podane, <parameter>liczba</parameter>
bêdzie sformatowana z <parameter>miejsc_dziesiêtnych</parameter>,
z <parameter>przecinek_dziesiêtny</parameter> zamiast kropki (".") i
<parameter>separator_tysiêcy</parameter> pomiêdzy ka¿d± grup± tysiêcy.
</para>
<note>
<para>
Tylko pierwszy znak z <parameter>separator_tysiêcy</parameter> jest
wykorzystywany. Na przyk³ad, je¶li u¿yjesz <literal>foo</literal> jako
separatora, to z liczby <literal>1000</literal> funkcja zwróci
<literal>1f000</literal>.
</para>
</note>
<para>
<example>
<title><function>number_format</function> - przyk³ady</title>
<para>
W polskiej notacji liczbowej u¿ywa siê przecinka (",") jako przecinka
dziesiêtnego i spacji (" ") jako separatora tysiêcy. W PHP mo¿na
to zrobiæ tak:
</para>
<programlisting role="php">
<![CDATA[
<?php
$liczba = 1234.56;
// notacja angielska (domy¶lna)
$notacja_angielska = number_format($liczba);
// 1,234.56
// notacja polska
$notacja_polska = number_format($liczba, 2, ',', ' ');
// 1 234,56
$number = 1234.5678;
// notacja angielska bez separatora tysiêcy
$notacja_angielska = number_format($liczba, 2, '.', '');
// 1234.57
?>
]]>
</programlisting>
</example>
</para>
<para>
Patrz tak¿e: <function>money_format</function>,
<function>sprintf</function>,
<function>printf</function> i <function>sscanf</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->