cvs: phpdoc /cs/functions apache.xml aspell.xml bc.xml com.xml dir.xml dl.xml filepro.xml gettext.xml http.xml info.xml mail.xml misc.xml readline.xml
recode.xml strings.xml url.xml
| From: | Roman Neuhauser | Date: | Wed, 24 Jan 2001 13:37:49 +0000 |
| Subject: | cvs: phpdoc /cs/functions apache.xml aspell.xml bc.xml com.xml dir.xml dl.xml filepro.xml gettext.xml http.xml info.xml mail.xml misc.xml readline.xml recode.xml strings.xml url.xml |
||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969333908@lists.php.net to get a copy of this message | ||
cynic Wed Jan 24 05:37:49 2001 EDT
Added files:
/phpdoc/cs/functions apache.xml aspell.xml bc.xml com.xml dir.xml
dl.xml filepro.xml gettext.xml http.xml
info.xml mail.xml misc.xml readline.xml
recode.xml strings.xml url.xml
Log:
second attempt :) all files should be completely translated except for
strings.xml which is nowhere near completion
Index: phpdoc/cs/functions/apache.xml +++ phpdoc/cs/functions/apache.xml <reference id="ref.apache"> <title>Funkce specifické pro Apache</title> <titleabbrev>Apache</titleabbrev> <refentry id="function.apache-lookup-uri"> <refnamediv> <refname>apache_lookup_uri</refname> <refpurpose> Provádí èásteèný poadavek na zadanou URI a vrací vechno info o ní </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>class <function>apache_lookup_uri</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce provádí èásteèný poadavek na URI. Jde jen tak daleko, aby získala vechny dùleité informace o daném zdroji a vrací tyto informace ve tøídì. Vlastnosti této tøídy jsou: <simplelist> <member>status</member> <member>the_request</member> <member>status_line</member> <member>method</member> <member>content_type</member> <member>handler</member> <member>uri</member> <member>filename</member> <member>path_info</member> <member>args</member> <member>boundary</member> <member>no_cache</member> <member>no_local_copy</member> <member>allowed</member> <member>send_bodyct</member> <member>bytes_sent</member> <member>byterange</member> <member>clength</member> <member>unparsed_uri</member> <member>mtime</member> <member>request_time</member> </simplelist> </para> <note> <simpara> <function>Apache_lookup_uri</function> pouze, pokud je PHP nainstalováno jako modul Apache. </simpara> </note> </refsect1> </refentry> <refentry id="function.apache-note"> <refnamediv> <refname>apache_note</refname> <refpurpose>Získává a nastavuje poznámky poadavku u Apache.</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>apache_note</function></funcdef> <paramdef>string <parameter>note_name</parameter></paramdef> <paramdef>string <parameter> <optional>note_value</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>Apache_note</function> je funkce specifická pro Apache, která získává a nastavuje hodnoty v tabulce <literal>poznámek</literal> poadavku. Pøi volání s jedním argumentem vrací souèasnou hodnotu poznámky <literal>note_name</literal>. Pøi volání se dvìma argumenty nastavuje hodnotu poznámky <literal>note_name</literal> na <literal>note_value</literal>, a vrací pøedchozí hodnotu poznámky <literal>note_name</literal>. </para> </refsect1> </refentry> <refentry id="function.getallheaders"> <refnamediv> <refname>getallheaders</refname> <refpurpose>Získává vechny hlavièky HTTP poadavku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>getallheaders</function></funcdef> <paramdef>void<parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrací asociativní pole vech HTTP hlavièek v souèasném poadavku. </para> <para> <note> <para> Hodnotu bìných CGI promìnných mùete také získat tím, e je pøeètete z prostøedí, co funguje, a pouíváte PHP jako modu Apache nebo ne. Pokud chcete vidìt seznam vech systémových promìnných definovaných tímto zpùsobem, pouijte <function>phpinfo</function>. </para> </note> </para> <para> <example> <title><function>getallheaders</function> Example</title> <programlisting role="php"> $headers = getallheaders(); while (list ($header, $value) = each ($headers)) { echo "$header: $value<br>\n"; } </programlisting> </example> </para> <para> Tento pøíklad zobrazí vechny hlavièky souèasného poadavku. <note> <simpara> <function>Getallheaders</function> je v souèasnosti podporována jen kdy PHP bìí jako modul <productname>Apache</productname>. </simpara> </note> </para> </refsect1> </refentry> <refentry id="function.virtual"> <refnamediv> <refname>virtual</refname> <refpurpose>Provádí sub-poadavek Apache</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>virtual</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Virtual</function> je funkce specifická pro Apache ekvivalentní s <!--#include virtual...--> v mod_include. Provádí sub-poadavek Apache. Je uiteèná pro vkládání CGI skriptù nebo .shtml souborù, nebo èehokoliv jiného, co má Apache parsovat. CGI skripty musí generovat platné CGI hlavièky. To znamená, e musí pøinejmením generovat Content-type hlavièku. Pro PHP soubory musíte pouít <function>include</function> nebo <function>require</function>; <function>virtual</function> se nedá pouít k vloení dokumentu, který je sám PHP skriptem. </para> </refsect1> </refentry> <refentry id="function.ascii2ebcdic"> <refnamediv> <refname>ascii2ebcdic</refname> <refpurpose>Pøekládá øetìzec z ASCII do EBCDIC</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ascii2ebcdic</function></funcdef> <paramdef>string <parameter>ascii_str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>ascii2ebcdic</function> je funkce specifická pro Apache dostupná pouze na operaèních systémech zaloených na EBCDIC (OS/390, BS2000). Pøekládá (binárnì bezpeènì) øeìzec v ASCII kódování <parameter>ascii_str</parameter> na jeho ekvivalentní EBCDIC reprezentaci, a vrací výsledek. </para> <para> Viz také opaènou funkci <function>ebcdic2ascii</function> </para> </refsect1> </refentry> <refentry id="function.ebcdic2ascii"> <refnamediv> <refname>ebcdic2ascii</refname> <refpurpose>Pøekládá øetìzec z EBCDIC do ASCII</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ebcdic2ascii</function></funcdef> <paramdef>string <parameter>ebcdic_str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>ebcdic2ascii</function> je funkce specifická pro Apache dostupná pouze na operaèních systémech zaloených na EBCDIC (OS/390, BS2000). Pøekládá (binárnì bezpeènì) øeìzec v kódování EBCDIC <parameter>ascii_str</parameter> na jeho ekvivalentní ASCII reprezentaci, a vrací výsledek. </para> <para> Viz také opaènou funkci <function>ascii2ebcdic</function> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/aspell.xml +++ phpdoc/cs/functions/aspell.xml <reference id="ref.aspell"> <title>Aspell funkce</title> <titleabbrev>Aspell</titleabbrev> <partintro> <simpara> <function>aspell</function> funkce umoòují ovìøit hláskování slova a nabídnout moné opravy. </simpara> <note> <simpara> aspell funguje pouze s velmi starými (do pøiblinì .27.*) verzemi aspell knihovny. Tento modul, ani tyto verze aspell knihovny u nejsou podporovány. Pokud chcete v PHP pouít kontrolu hláskování, pouijte místo toho <link linkend="ref.pspell">pspell</link>. Vyuívá pspell knihovnu, a pracuje s novìjími verzemi aspellu. </simpara> </note> <simpara> Budete potøebovat aspell knihovnu dostupnou z: <ulink url="&url.aspell;">&url.aspell;</ulink>. </simpara> </partintro> <refentry id="function.aspell-new"> <refnamediv> <refname>aspell_new</refname> <refpurpose>Naèíst nový slovník</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>aspell_new</function></funcdef> <paramdef>string <parameter>master</parameter></paramdef> <paramdef>string <parameter>personal</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_new</function> otevøe nový slovník, a vrátí identifikátor spojení na tento slovník vyuitelný s dalími aspell funkcemi. </simpara> <para> <example> <title><function>Aspell_new</function></title> <programlisting role="php"> $aspell_link=aspell_new ("english"); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.aspell-check"> <refnamediv> <refname>aspell_check</refname> <refpurpose>Zkontrolovat slovo</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>aspell_check</function></funcdef> <paramdef>int <parameter>dictionary_link</parameter></paramdef> <paramdef>string <parameter>word</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_check</function> zkontroluje hláskování slova a vrátí <literal>true</literal>, pokud je hláskování správné, a <literal>false</literal>, pokud není. </simpara> <para> <example> <title><function>Aspell_check</function></title> <programlisting> $aspell_link=aspell_new ("english"); if (aspell_check ($aspell_link, "testt")) { echo "Toto je platné hláskování"; } else { echo "Pardon, patné hláskování"; } </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.aspell-check-raw"> <refnamediv> <refname>aspell_check_raw</refname> <refpurpose> Zkontrolovat slovo beze zmìny velikosti písmen nebo pokusù o oøezání </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>aspell_check_raw</function></funcdef> <paramdef>int <parameter>dictionary_link</parameter></paramdef> <paramdef>string <parameter>word</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_check_raw</function> zkontroluje hláskování slova beze zmìn velikosti písmen nebo pokusù ho jakýmkoliv zpùsobem oøezat, a vrátí <literal>true</literal>, pokud je hláskování správné, a <literal>false</literal>, pokud není. </simpara> <para> <example> <title><function>Aspell_check_raw</function></title> <programlisting role="php"> $aspell_link=aspell_new ("english"); if (aspell_check_raw ($aspell_link, "test")) { echo "Toto je platné hláskování"; } else { echo "Pardon, patné hláskování"; } </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.aspell-suggest"> <refnamediv> <refname>aspell_suggest</refname> <refpurpose>Nabídnout moné hláskování slova</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>aspell_suggest</function></funcdef> <paramdef>int <parameter>dictionary_link</parameter></paramdef> <paramdef>string <parameter>word</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_suggest</function> vrátí pole moných hláskování daného slova. </simpara> <para> <example> <title><function>Aspell_suggest</function></title> <programlisting role="php"> $aspell_link=aspell_new ("english"); if (!aspell_check ($aspell_link, "test")) { $suggestions=aspell_suggest ($aspell_link, "test"); for ($i=0; $i < count ($suggestions); $i++) { echo "Moné hláskování: " . $suggestions[$i] . "<br>"; } } </programlisting> </example> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/bc.xml +++ phpdoc/cs/functions/bc.xml <reference id="ref.bc"> <title>BCMath funkce pro výpoèty s libovolnou pøesností</title> <titleabbrev>BC math</titleabbrev> <partintro> <para> Tyto funkce jsou dostupné pouze pokud bylo PHP zkonfigurováno s <option role="configure">--enable-bcmath</option>. </para> </partintro> <refentry id="function.bcadd"> <refnamediv> <refname>bcadd</refname> <refpurpose>Seèíst dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcadd</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Pøiète <parameter>left operand</parameter> k <parameter>right operand</parameter> a vrátí souèet v øetìzci. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcsub</function>. </para> </refsect1> </refentry> <refentry id="function.bccomp"> <refnamediv> <refname>bccomp</refname> <refpurpose>Porovnat dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>bccomp</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Porovná <parameter>left operand</parameter> s <parameter>right operand</parameter> a vrátí výsledek jako integer. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst pouitých pøi porovnání. Návratová hodnota je 0, pokud jsou si oba operandy rovné. Pokud je <parameter>left operand</parameter> vìtí ne <parameter>right operand</parameter>, návratová hodnota je +1, a pokud je <parameter>left operand</parameter> mení ne <parameter>right operand</parameter>, návratová hodnota je -1. </para> </refsect1> </refentry> <refentry id="function.bcdiv"> <refnamediv> <refname>bcdiv</refname> <refpurpose>Dìlit dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcdiv</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Vydìlí argument <parameter>left operand</parameter> argumentem <parameter>right operand</parameter> a vrátí výsledek. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcmul</function>. </para> </refsect1> </refentry> <refentry id="function.bcmod"> <refnamediv> <refname>bcmod</refname> <refpurpose>Získat modulus èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcmod</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>modulus</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí modulus argumentu <parameter>left operand</parameter> s pouitím argumentu <parameter>modulus</parameter>. </para> <para> Viz také <function>bcdiv</function>. </para> </refsect1> </refentry> <refentry id="function.bcmul"> <refnamediv> <refname>bcmul</refname> <refpurpose>Vynásobit dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcmul</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Vynásobí argument <parameter>left operand</parameter> argumentem <parameter>right operand</parameter> a vrátí výsledek. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcdiv</function>. </para> </refsect1> </refentry> <refentry id="function.bcpow"> <refnamediv> <refname>bcpow</refname> <refpurpose> Umocnit jedno èíslo na jiné s libovolnou pøesností </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcpow</function></funcdef> <paramdef>string <parameter>x</parameter></paramdef> <paramdef>string <parameter>y</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Umocní <parameter>x</parameter> na <parameter>y</parameter>. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcsqrt</function>. </para> </refsect1> </refentry> <refentry id="function.bcscale"> <refnamediv> <refname>bcscale</refname> <refpurpose>Nastavit výchozí kálu pro vechny bc math funkce </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcscale</function></funcdef> <paramdef>int <parameter>scale</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce nastaví výchozí kálu pro vechna následná volání bc math funkcí, ktera neudávají explicitnì kálu pøesnosti. </para> </refsect1> </refentry> <refentry id="function.bcsqrt"> <refnamediv> <refname>bcsqrt</refname> <refpurpose> Získat druhou odmocninu èísla s libovolnou pøesností </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcsqrt</function></funcdef> <paramdef>string <parameter>operand</parameter></paramdef> <paramdef>int <parameter>scale</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí druhou odmocninu argumentu <parameter>operand</parameter>. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcpow</function>. </para> </refsect1> </refentry> <refentry id="function.bcsub"> <refnamediv> <refname>bcsub</refname> <refpurpose> Odeèíst jedno èíslo od druhého s libovolnou pøesností </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcsub</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Odeète argument <parameter>right operand</parameter> od argumentu <parameter>left operand</parameter> a vrátí výsledek v øetìzci. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcadd</function>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/com.xml +++ phpdoc/cs/functions/com.xml <reference id="ref.com"> <title>Funkce na podporu COM ve Windows</title> <titleabbrev>COM</titleabbrev> <partintro> <simpara> Tyto funkce jsou dostupné pouze ve Windows verzi PHP. Tyto funkce byly pøidány v PHP 4. </simpara> </partintro> <refentry id="function.com-load"> <refnamediv> <refname>com_load</refname> <refpurpose> Creates a new reference to a COM component </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>com_load</function></funcdef> <paramdef>string <parameter>module name</parameter></paramdef> <paramdef>string <parameter> <optional>server name</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>com_load</function> vytváøí novou COM komponentu a vrací odkaz na ni. Pøi neúspìchu vrací <literal>false</literal>. </para> </refsect1> </refentry> <refentry id="function.com-invoke"> <refnamediv> <refname>com_invoke</refname> <refpurpose> Volá metodu COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>com_invoke</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>function_name</parameter></paramdef> <paramdef>mixed <parameter> <optional>function parameters, ...</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>Com_invoke</function> volá metodu COM komponenty odkazované <parameter>com_object</parameter>. Pokud dojde k chybì, vrací <literal>false</literal>, pøi úspìchu vrací návratovou hodnotu metody <parameter>function_name</parameter>. </para> </refsect1> </refentry> <refentry id="function.com-propget"> <refnamediv> <refname>com_propget</refname> <refpurpose> Získává hodnotu vlastnosti COM komponenty </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>com_propget</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je alias k <function>com_get</function>. </para> </refsect1> </refentry> <refentry id="function.com-get"> <refnamediv> <refname>com_get</refname> <refpurpose> Získává hodnotu vlastnosti COM komponenty </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>com_get</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací hodnotu <parameter>property</parameter> COM komponenty odkazované <parameter>com_object</parameter>. Pøi chybì vrací <literal>false</literal>. </para> </refsect1> </refentry> <refentry id="function.com-propput"> <refnamediv> <refname>com_propput</refname> <refpurpose> Pøiøazuje hodnotu vlastnosti COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>com_propput</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je alias ke <function>com_set</function>. </para> </refsect1> </refentry> <refentry id="function.com-propset"> <refnamediv> <refname>com_propset</refname> <refpurpose> Pøiøazuje hodnotu vlastnosti COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>com_propset</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je alias ke <function>com_set</function>. </para> </refsect1> </refentry> <refentry id="function.com-set"> <refnamediv> <refname>com_set</refname> <refpurpose> Pøiøazuje hodnotu vlastnosti COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>com_set</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Nastavuje hodnotu vlastnosti <parameter>property</parameter> COM komponent odkazované <parameter>com_object</parameter>. Vrací <literal>true</literal>, pokud je <parameter>property</parameter> nastaveno. Pøi chybì vrací <literal>false</literal>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/dir.xml +++ phpdoc/cs/functions/dir.xml <reference id="ref.dir"> <title>Adresáøové funkce</title> <titleabbrev>Adresáøe</titleabbrev> <refentry id="function.chdir"> <refnamediv> <refname>chdir</refname> <refpurpose>change directory</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>chdir</function></funcdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Mìní aktuální adresáø PHP na <parameter>directory</parameter>. Pokud se nepodaøilo zmìnít adresáø, vrací FALSE, jinak TRUE. </para> </refsect1> </refentry> <refentry id="class.dir"> <refnamediv> <refname>dir</refname> <refpurpose>directory class</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>new <function>dir</function></funcdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pseudo-objektovì orientovaný mechanismus pro ètení adresáøe. Otevøe zadaný <parameter>directory</parameter>. Po otevøení adresáøe jsou pøístupné dvì vlastnosti. Vlastnost handle je pouitelná s jinými adresáøovými funkcemi jako <function>readdir</function>, <function>rewinddir</function> a <function>closedir</function>. Hodnotou vlastnosti path je cesta k otevøenému adresáøi. Dále jsou pøístupné tøi metody: read, rewind a close. <example> <title><function>Dir</function> pøíklad</title> <programlisting role="php"> $d = dir("/etc"); echo "Handle: ".$d->handle."<br>\n"; echo "Path: ".$d->path."<br>\n"; while($entry=$d->read()) { echo $entry."<br>\n"; } $d->close(); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.closedir"> <refnamediv> <refname>closedir</refname> <refpurpose>Zavírá otevøený adresáø</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>closedir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Zavírá proud z adresáøe specifikovaný v <parameter>dir_handle</parameter>. Proud musí pocházet z funkce <function>opendir</function>. </para> </refsect1> </refentry> <refentry id="function.getcwd"> <refnamediv> <refname>getcwd</refname> <refpurpose>Získává aktuální pracovní adresáø</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>getcwd</function></funcdef> <void/> </funcprototype> </funcsynopsis> <para> Vrací aktuální pracovní adresáø. </para> </refsect1> </refentry> <refentry id="function.opendir"> <refnamediv> <refname>opendir</refname> <refpurpose>Otevøe adresáø</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>opendir</function></funcdef> <paramdef>string <parameter>path</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací deskriptor adresáøe pouitelný v následných voláních <function>closedir</function>, <function>readdir</function>, a <function>rewinddir</function>. </para> </refsect1> </refentry> <refentry id="function.readdir"> <refnamediv> <refname>readdir</refname> <refpurpose>Pøeète poloku z deskriptoru adresáøe</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>readdir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací název dalího souboru v adresáøi. Názvy souborù nejsou nijak tøídìny. <example> <title>Vypi vechny soubory v adresáøi</title> <programlisting role="php"> // Note that !== did not exist until 4.0.0-RC2 <?php $handle=opendir('.'); echo "Directory handle: $handle\n"; echo "Files:\n"; while (($file = readdir($handle))!==false) { echo "$file\n"; } closedir($handle); ?> </programlisting> </example> </para> <para> Vimnìte si, e <function>readdir</function> vráí také . a .. poloky. Pokud je nechcete, mùete je snadno vynechat: <example> <title> Vypi vechny soubory v adresáøi a vynech . a .. </title> <programlisting role="php"> <?php $handle=opendir('.'); while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file\n"; } } closedir($handle); ?> </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.rewinddir"> <refnamediv> <refname>rewinddir</refname> <refpurpose>rewind directory handle</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>rewinddir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Resets the directory stream indicated by <parameter>dir_handle</parameter> to the beginning of the directory. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/dl.xml +++ phpdoc/cs/functions/dl.xml <reference id="ref.dl"> <title>Funkce pro dynamické naèítání</title> <titleabbrev>Dyn. naèítání</titleabbrev> <refentry id="function.dl"> <refnamediv> <refname>dl</refname> <refpurpose>naète extenzi PHP za bìhu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>dl</function></funcdef> <paramdef>string <parameter>library</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Naète extenzi PHP definovanou v <parameter>library</parameter>. Viz také konfiguraèní direktivu <link linkend="ini.extension-dir">extension_dir</link>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/filepro.xml +++ phpdoc/cs/functions/filepro.xml <reference id="ref.filepro"> <title>filePro funkce</title> <titleabbrev>filePro</titleabbrev> <partintro> <simpara> Tyto funkce umoòují read-only (pouze pro ètení) pøístup k datùm uloeným ve filePro databázích. </simpara> <simpara> filePro je registrovaná obchodní znaèka Fiserv, Inc. Více informací o filePro najdete na <ulink url="&url.filepro;">&url.filepro;</ulink>. </simpara> </partintro> <refentry id="function.filepro"> <refnamediv> <refname>filepro</refname> <refpurpose>Pøeèíst a ovìøit mapový soubor</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>bool <function>filepro</function></funcdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Pøeète a ovìøí mapový soubor a uloí poèet sloupcù a info.</para> <para> Nedochází k zamykání, take byste se mìli vyhnout úpravám vaí filePro databáze, pokud mùe být otevøena v PHP. </para> </refsect1> </refentry> <refentry id="function.filepro-fieldname"> <refnamediv> <refname>filepro_fieldname</refname> <refpurpose>Zjistit název sloupce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>filepro_fieldname</function></funcdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí název sloupce odpovídajícího <parameter>field_number</parameter>. </para> </refsect1> </refentry> <refentry id="function.filepro-fieldtype"> <refnamediv> <refname>filepro_fieldtype</refname> <refpurpose>Zjistit typ sloupce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>filepro_fieldtype</function></funcdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí editaèní typ sloupce odpovídajícího <parameter>field_number</parameter>. </para> </refsect1> </refentry> <refentry id="function.filepro-fieldwidth"> <refnamediv> <refname>filepro_fieldwidth</refname> <refpurpose>Zjistit íøku sloupce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>filepro_fieldwidth</function></funcdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí íøku sloupce odpovídajícího <parameter>field_number</parameter>. </para> </refsect1> </refentry> <refentry id="function.filepro-retrieve"> <refnamediv> <refname>filepro_retrieve</refname> <refpurpose>Získat data z filePro databáze</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>filepro_retrieve</function></funcdef> <paramdef>int <parameter>row_number</parameter></paramdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Vrátí data z urèeného místa v databázi.</para> </refsect1> </refentry> <refentry id="function.filepro-fieldcount"> <refnamediv> <refname>filepro_fieldcount</refname> <refpurpose>Zjistit, kolik sloupcù je ve filePro databázi</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>filepro_fieldcount</function></funcdef> <void/> </funcprototype> </funcsynopsis> <para>Vrátí poèet polí (sloupcù) v otevøené filePro databázi.</para> <para> Viz také <function>filepro</function>.</para> </refsect1> </refentry> <refentry id="function.filepro-rowcount"> <refnamediv> <refname>filepro_rowcount</refname> <refpurpose>Zjistit, kolik øádkù je ve filePro databázi</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>filepro_rowcount</function></funcdef> <void/> </funcprototype> </funcsynopsis> <para>Vrátí poèet øádkù v otevøené filePro databázi.</para> <para> Viz také <function>filepro</function>.</para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/gettext.xml +++ phpdoc/cs/functions/gettext.xml <reference id="ref.gettext"> <title>GNU Gettext</title> <titleabbrev>gettext</titleabbrev> <partintro> <simpara> Gettext funkce implementujíc NLS (Native Language Support) API, která se dá pouít k internacionalizaci vaich PHP aplikací. Dùkladné vysvìtlení tìchto funkcí viz dokumentaci GNU Gettext. </simpara> </partintro> <refentry id="function.bindtextdomain"> <refnamediv> <refname>bindtextdomain</refname> <refpurpose>Nastavit cestu pro doménu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bindtextdomain</function></funcdef> <paramdef>string <parameter>domain</parameter></paramdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Funkce <function>bindtextdomain</function> nastaví cestu pro doménu. </para> </refsect1> </refentry> <refentry id="function.dcgettext"> <refnamediv> <refname>dcgettext</refname> <refpurpose>Zmìnit doménu pro jediné vyhledání</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>dcgettext</function></funcdef> <paramdef>string <parameter>domain</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> <paramdef>int <parameter>category</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vám umoní zmenit souèasnou doménu pro jediné vyhledání zprávy. Umoòuje také specifikovat kategorii. </para> </refsect1> </refentry> <refentry id="function.dgettext"> <refnamediv> <refname>dgettext</refname> <refpurpose>Zmìnit souèasnou doménu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>dgettext</function></funcdef> <paramdef>string <parameter>domain</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Funkce <function>dgettext</function> umoòuje zmìnit souèasnou doménu pro jediné vyhledání zprávy. </para> </refsect1> </refentry> <refentry id="function.gettext"> <refnamediv> <refname>gettext</refname> <refpurpose>Vyhledat zprávu v souèasné doménì</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>gettext</function></funcdef> <paramdef>string <parameter>message</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí pøeloený øetìzec, pokud jej najde v pøekladové tabulce, nebo pøedaný øetìzec, pokud jej nenajde. Jako alias k této funkci mùete pouít podtrítko. </para> <example> <title><function>Gettext</function>-check</title> <programlisting> <?php // Set language to German putenv ("LANG=de"); // Specify location of translation tables bindtextdomain ("myPHPApp", "./locale"); // Choose domain textdomain ("myPHPApp"); // Print a test message print (gettext ("Vítejte v mé PHP Aplikaci")); ?> </programlisting> </example> </refsect1> </refentry> <refentry id="function.textdomain"> <refnamediv> <refname>textdomain</refname> <refpurpose>Nastavit výchozí doménu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>textdomain</function></funcdef> <paramdef>string <parameter>text_domain</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce nastaví doménu pro vyhledávání pøi volání funkce <function>gettext</function>, obvykle pojmenovanou podle aplikace. Vrátí pøedchozí výchozí doménu. Pøi volání bez argumentù vrátí souèasné nastavení, ani by jej mìnila. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/http.xml +++ phpdoc/cs/functions/http.xml <reference id="ref.http"> <title>HTTP funkce</title> <titleabbrev>HTTP</titleabbrev> <partintro> <simpara> Tyto funkce vám umoòují manipulovat výstupem posílaným zpìt browseru pøímo na úrovni HTTP protokolu. </simpara> </partintro> <refentry id="function.header"> <refnamediv> <refname>header</refname> <refpurpose>Poslat HTTP hlavièku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>header</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Funkce <function>Header</function> se pouívá na zaèátku HTML souboru k odeslání HTTP hlavièek. Více informací o HTTP hlavièkách viz <ulink url="&spec.http1.1;">Specifikace HTTP 1.1</ulink>. <emphasis>Poznámka:</emphasis> Pamatujte, e funkce <function>Header</function> musí být volána døíve ne se odele jakýkoliv normální výstup, a u normálními HTML tagy, nebo z PHP. Velmi obvyklou chybou je naèítat kód pomocí <function>include</function> nebo auto_prepend a mít v tomto kódu prázdné øádky, které zpùsobí odeslání výstupu pøed voláním funkce <function>header</function>. </para> <para> Existují dva zvlátní pøípady volání funkce <function>header</function>. Prvním je hlavièka "Location". Ta nejene odele hlavièku browseru, ale navíc i vrátí Apachi stavový kód REDIRECT. Z pohledu autora skriptu by to nemìlo být dùleité, ale je to dùleité pro lidi, kteøí rozumí vnitønostem Apache. <informalexample> <programlisting role="php"> header ("Location: http://www.php.net"); /* Pøesmìrujeme browser na web site PHP */ exit; /* Pojistíme si, e se dalí kód nevykoná po pøesmìrování. */ </programlisting> </informalexample> </para> <para> Druhým zvlátním pøípadem jsou vechny hlavièky zaèínající øetìzcem "HTTP/" (velikost písmen nehraje roli). Napøíklad, pokud direktiva ErrorDocument 404 vaeho Apache ukazuje na PHP skript, nebylo by od vìci, kdyby skuteènì generoval 404. První vìcí, kterou byste v tomto skriptu mìli udìlat tudíz bude: <informalexample> <programlisting role="php"> header ("HTTP/1.0 404 Not Found"); </programlisting> </informalexample> </para> <para> PHP skripty èasto generují dynamické HTML, které nesmí být cachováno uivatelským browserem, ani ýdnými proxynami mezi serverem a uivatelským browserem. Mnoho proxyn a klientù se dá donutit k vypnutí cachování s pomocí <informalexample> <programlisting role="php"> header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // datum v minulosti header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // vdy upraven header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 </programlisting> </informalexample> </para> <para> Viz také <function>headers_sent</function> </para> </refsect1> </refentry> <refentry id="function.headers-sent"> <refnamediv> <refname>headers_sent</refname> <refpurpose>Vrátit true, pokud byly odeslány hlavièky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>headers_sent</function></funcdef> <paramdef><parameter>void</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí <literal>true</literal>, pokud u byly HTTP hlavièky odeslány, jinak <literal>false</literal>. </para> <para> Viz také <function>header</function> </para> </refsect1> </refentry> <refentry id="function.setcookie"> <refnamediv> <refname>setcookie</refname> <refpurpose>Poslat cookie</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>setcookie</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> <paramdef>string <parameter><optional>value</optional></parameter> </paramdef> <paramdef>int <parameter><optional>expire</optional></parameter> </paramdef> <paramdef>string <parameter><optional>path</optional></parameter> </paramdef> <paramdef>string <parameter><optional>domain</optional></parameter> </paramdef> <paramdef>int <parameter><optional>secure</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>Setcookie</function> definuje cookie, který se pole spolu s hlavièkami. Cookies se musí odeslat jako <emphasis>první</emphasis> ze vech HTTP hlavièek (to je omezení cookies, ne PHP). Volání této funkce musíte tudí umístit pøed <literal><html></literal> èi <literal><head></literal> tagy. </para> <para> Vechny argumenty kromì argumentu <parameter>name</parameter> jsou nepovinné. Pokud je pøítomný pouze argument <parameter>name</parameter>, u klienta se smae cookie tohoto jména. Kterýkoliv argument mùete také nahradit prázdným øetìzcem (<emphasis>""</emphasis>), èím tento argument pøeskoèíte. Argumenty <parameter>expire</parameter> a <parameter>secure</parameter> jsou celoèíselné a nedají se pøeskoèit prázdným øetìzcem. Místo toho pouijte nulu (<emphasis>0</emphasis>). Argument <parameter>expire</parameter> je bìné Unixové celoèíselné vyjádøení èasu, jak je vrací funkce <function>time</function> èi <function>mktime</function>. Argument <parameter>secure</parameter> indikuje, e by se tento cookie mìl pøenáet pouze po zabezpeèeném HTTPS spojení. </para> <para> Bìné zádrhele: <itemizedlist> <listitem> <simpara> Cookies jsou pøístupné a pøi dalím naètení stránky, na které pøístupné být mají. </simpara> </listitem> <listitem> <simpara> Cookies se musí mazat se stejnými parametry, se kterými byly odeslány. </simpara> </listitem> </itemizedlist> </para> <simpara> V PHP 3 se vícenásobná volání <function>setcookie</function> v jednom skriptu provedou v opaèném poøadí. Pokud se pokouíte smazat jeden cookie pøe odesláním jiného, mìli byste umístit vloení pøed smazání. V PHP 4 se vícenásobná volání <function>setcookie</function> provedou v tom poøadí, jak jsou volána. </simpara> <para> Nìkolik pøíkladù, jak posílat cookies: <example> <title>Ukázky odeslání cookies pomocí <function>setcookie</function></title> <programlisting role="php"> setcookie ("TestCookie", "Zkuební hodnota"); setcookie ("TestCookie", $value,time()+3600); /* vyprí za hodinu */ setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1); </programlisting> </example> </para> <para> Následují pøíklady mazání cookies z pøedchozí ukázky: <example> <title>Ukázky mazání cookies pomocí <function>setcookie</function></title> <programlisting role="php"> setcookie ("TestCookie"); // nastaví dobu vyprení na èas pøed hodinou setcookie ("TestCookie", "", time() - 3600); setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".utoronto.ca", 1); </programlisting> </example> Pøi mazání cookie byste se mìli ujistit, e je doba vyprení v minulosti, èím se v browseru zapne mechanismus odstranìní cookie. </para> <para> Vimnìte si, e hodnotová èást cookie se pøi odeslání cookie automaticky url-zakóduje, a pøi pøijetí se automaticky dekóduje a pøiøadí promìnné stejného jména, jako je jméno cookie. Pokud chcete vidìt obsah naeho zkuebního cookie, pouijte nìkterý z následujících pøíkladù: <informalexample> <programlisting role="php"> echo $TestCookie; echo $HTTP_COOKIE_VARS["TestCookie"]; </programlisting> </informalexample> </para> <para> Cookies obsahující pole mùete také odeslat tak, e za název cookie napíete hranaté závorky. Úèinkem tohoto je odeslání tolika cookies, kolik má vae pole prvkù, ale kdy vá skript tyto cookies pøijme, hodnoty se umístí v poli stejného jména, jako jsou vae cookies: <informalexample> <programlisting role="php"> setcookie ("cookie[three]", "cookiethree"); setcookie ("cookie[two]", "cookietwo"); setcookie ("cookie[one]", "cookieone"); if (isset ($cookie)) { while (list ($name, $value) = each ($cookie)) { echo "$name == $value<br>\n"; } } </programlisting> </informalexample> </para> <para> Více informací o cookies viz specifikace cookies na <ulink url="&spec.cookies;">&spec.cookies;</ulink>. </para> <simpara> Microsoft Internet Explorer 4 se Service Packem 1 zpracovává chybnì cookies, které mají nastavený argument <parameter>path</parameter>. </simpara> <simpara> Netscape Communicator 4.05 a Microsoft Internet Explorer 3.x zøejmì nezpracují cookies správnì, pokud nejsou nastaveny argumenty <parameter>path</parameter> a <parameter>time</parameter>. </simpara> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/info.xml +++ phpdoc/cs/functions/info.xml <reference id="ref.info"> <title>PHP volby & informace</title> <titleabbrev>PHP volby/info</titleabbrev> <refentry id="function.assert"> <refnamediv> <refname>assert</refname> <refpurpose>Ovìøit, jestli je výrok neplatný</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>assert</function></funcdef> <paramdef>string|bool <parameter>assertion</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>assert</function> ovìøí pøedanou <parameter>assertion</parameter> a provede pøíslunou akci, pokud je výsledek <literal>false</literal>. </para> <para> Pokud je pøedaná <parameter>assertion</parameter> øetìzec, vyhodnotí se funkcí <function>assert</function> jako PHP kód. Výhody øetìzcové <parameter>assertion</parameter> jsou mení reie, kdy je kontrola výrokù vypnutá, a zprávy obsahující <parameter>assertion</parameter> výraz, kdy výrok sele. </para> <para> Kontrola výrokù by se mìla pouívat jen pro odlaïování skriptù. Mùete je pouít na kontrolu podmínek, které by mìly být vdycky true, a které jinak indikují nìjaké chyby v programování, nebo na kontrolu existence urèitých vlastností, jako jsou funkce obsaené v extenzích, nebo urèité systémové limity a vlastnosti. </para> <para> Výroky by se nemìly pouívat pro bìné operace jako kontrola vstupních parametrù. Jako základní pravidlo platí, e vá kód by mìl fungovat správnì, pokud není kontrola výrokù aktivována. </para> <para> Chování funkce <function>assert</function> lze konfigurovat skrze <function>assert_options</function> nebo .ini direktivy popsané na manuálové stránce této funkce. </para> </refsect1> </refentry> <refentry id="function.assert-options"> <refnamediv> <refname>assert_options</refname> <refpurpose>Nastavit/získat rùzné pøíznaky výrokù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>assert_options</function></funcdef> <paramdef>int <parameter>what</parameter></paramdef> <paramdef>mixed <parameter><optional>value</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> S pouitím funkce <function>assert_options</function> mùete nastavit rùzné øídící volby funkce <function>assert</function>, nebo jen získat jejich souèasné nastavení. </para> <table> <title>Volby výrokù</title> <tgroup cols="4"> <thead> <row> <entry>volba</entry> <entry>ini parametr</entry> <entry>výchozí hodnota</entry> <entry>popis</entry> </row> </thead> <tbody> <row> <entry>ASSERT_ACTIVE</entry> <entry>assert.active</entry> <entry>1</entry> <entry>zapne <function>assert</function> vyhodnocování</entry> </row> <row> <entry>ASSERT_WARNING</entry> <entry>assert.warning</entry> <entry>1</entry> <entry>vytvoøí PHP varování pro kadý selhaví výrok</entry> </row> <row> <entry>ASSERT_BAIL</entry> <entry>assert.bail</entry> <entry>0</entry> <entry>ukonèí provádìní skiptu, pokud výrok sele</entry> </row> <row> <entry>ASSERT_QUIET_EVAL</entry> <entry>assert.quiet_eval</entry> <entry>0</entry> <entry> vypne error_reporting bìhem vyhodnocování výrazù výrokù </entry> </row> <row> <entry>ASSERT_CALLBACK</entry> <entry>assert_callback</entry> <entry>(null)</entry> <entry>uivatelská funkce, která se zavolá pro kadý selhaví výrok</entry> </row> </tbody> </tgroup> </table> <para> <function>assert_options</function> vrací pùvodní nastavení volby, nebo <literal>false</literal> pøi chybì. </para> </refsect1> </refentry> <refentry id="function.extension-loaded"> <refnamediv> <refname>extension_loaded</refname> <refpurpose>zjistit, jestli je extenze naètená</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>bool <function>extension_loaded</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrací true, pokud je extenze identifikovaná argumentem <parameter>name</parameter> naètena. Názvy rùzných extenzí mùete vidìt, pokud pouijete <function>phpinfo</function>. </simpara> <para> Viz také <function>phpinfo</function>. <note> <para> Tato funkce byla pøidána v PHP 3.0.10. </para> </note> </para> </refsect1> </refentry> <refentry id="function.dl"> <refnamediv> <refname>dl</refname> <refpurpose>Naèíst extenzi PHP za bìhu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>dl</function></funcdef> <paramdef>string <parameter>library</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Naète extenzi PHP definovanou v <parameter>library</parameter>. Viz také konfiguraèní direktivu <link linkend="ini.extension-dir">extension_dir</link>. </para> </refsect1> </refentry> <refentry id="function.getenv"> <refnamediv> <refname>getenv</refname> <refpurpose>Získat hodnotu systémové promìnné</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>getenv</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí hodnotu systémové promìnné <parameter>varname</parameter>, nebo false pøi chybì. <informalexample> <programlisting> $ip = getenv ("REMOTE_ADDR"); // získá IP adresu uivatele </programlisting> </informalexample> </para> <para> Seznam vech systémových promìnných si mùete prohlédnout pouitím <function>phpinfo</function>. Význam mnoha z nich najdete v <ulink url="&url.cgispecs;">CGI specifikaci</ulink>, zvlátì na <ulink url="&url.cgispec;">stránce o systémových promìnných</ulink>. <note> <para> Tato funkce nefunguje v ISAPI módu. </para> </note> </para> </refsect1> </refentry> <refentry id="function.get-cfg-var"> <refnamediv> <refname>get_cfg_var</refname> <refpurpose>Získat hodnotu volby z konfigurace PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>get_cfg_var</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí souèasnou hodnotu konfiguraèní promìnné PHP urèené argumentem <parameter>varname</parameter>, nebo false pokud dojde k chybì. </simpara> <simpara> Nevrací konfiguraèní hodnoty nastavené pøi kompilaci PHP a neète konfiguraèní soubor Apache (pouití php3_configuration_option direktiv). </simpara> <simpara> Pokud chcete zjistit, jestli daný systém pouívá <link linkend="configuration.file">konfiguraèní soubor</link>, zkuste získat hodnotu konfiguraèní volby cfg_file_path. Pokud je tato dostupná, pouívá se konfiguraèní soubor. </simpara> </refsect1> </refentry> <refentry id="function.get-current-user"> <refnamediv> <refname>get_current_user</refname> <refpurpose>Získat jméno vlastníka souèasného PHP skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>get_current_user</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí jméno vlastníka souèasného PHP skriptu. </simpara> <simpara> Viz také <function>getmyuid</function>, <function>getmypid</function>, <function>getmyinode</function>, a <function>getlastmod</function>. </simpara> </refsect1> </refentry> <refentry id="function.get-magic-quotes-gpc"> <refnamediv> <refname>get_magic_quotes_gpc</refname> <refpurpose>Získat souèasné aktivní nastavení magic_quotes_gpc</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>long <function>get_magic_quotes_gpc</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí souèasné aktivní nastavení <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>. (0 pro vypnuto, 1 pro zapnuto). </simpara> <simpara> Viz také <function>get_magic_quotes_runtime</function>, <function>set_magic_quotes_runtime</function>. </simpara> </refsect1> </refentry> <refentry id="function.get-magic-quotes-runtime"> <refnamediv> <refname>get_magic_quotes_runtime</refname> <refpurpose>Vrátit souèasné aktivní nastavení magic_quotes_runtime</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>long <function>get_magic_quotes_runtime</function> </funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí souèasné aktivní nastavení <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>. (0 pro vypnuto, 1 pro zapnuto). </simpara> <simpara> Viz také <function>get_magic_quotes_gpc</function>, <function>set_magic_quotes_runtime</function>. </simpara> </refsect1> </refentry> <refentry id="function.getlastmod"> <refnamediv> <refname>getlastmod</refname> <refpurpose>Získat èas poslení modifikace skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getlastmod</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí èas poslení modifikace souèasné stránky. Návratová hodnota je Unixový timestamp, vhodný jako vstup pro <function>date</function>. Pøi chybì vrací false. <example> <title>getlastmod() pøíklad</title> <programlisting role="php"> // outputs e.g. 'Last modified: March 04 1998 20:43:59.' echo "Last modified: ".date ("F d Y H:i:s.", getlastmod()); </programlisting> </example> </para> <para> See alse <function>date</function>, <function>getmyuid</function>, <function>get_current_user</function>, <function>getmyinode</function>, and <function>getmypid</function>. </para> </refsect1> </refentry> <refentry id="function.getmyinode"> <refnamediv> <refname>getmyinode</refname> <refpurpose>Získat inode souèasného skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getmyinode</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí inode souèasného skriptu, nebo false pøi chybì. </para> <para> Viz také <function>getmyuid</function>, <function>get_current_user</function>, <function>getmypid</function>, and <function>getlastmod</function>. </para> <note> <simpara> Tato funkce není podporována na Windows systémech. </simpara> </note> </refsect1> </refentry> <refentry id="function.getmypid"> <refnamediv> <refname>getmypid</refname> <refpurpose>Získat process ID PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getmypid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí process ID souèasného PHP procesu, nebo false pøi chybì. </para> <warning> <para> Process ID nejsou unikátní, a jsou tudí slabým zdrojem entropie. Nedoporuèujeme pouívat PIDy v prostøedích závislých na bezpeènosti. </para> </warning> <para> Viz také <function>getmyuid</function>, <function>get_current_user</function>, <function>getmyinode</function>, a <function>getlastmod</function>. </para> </refsect1> </refentry> <refentry id="function.getmyuid"> <refnamediv> <refname>getmyuid</refname> <refpurpose>Získat UID majitele PHP skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getmyuid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí user ID souèasného skriptu, nebo false pøi chybì. </simpara> <simpara> Viz také <function>getmypid</function>, <function>get_current_user</function>, <function>getmyinode</function>, a <function>getlastmod</function>. </simpara> </refsect1> </refentry> <refentry id="function.getrusage"> <refnamediv> <refname>getrusage</refname> <refpurpose>Získat informace o souèasném vyuití zdrojù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>getrusage</function></funcdef> <paramdef>int <parameter><optional>who</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Toto je rozhraní ke to getrusage(2). Vrátí asociativní pole obsahující vechna data vrácená systémovým voláním. Pokud je who 1, getrusage se zavolá s RUSAGE_CHILDREN. </para> <para> Vechny poloky jsou pøístupné skrze svá dokumentovaná jména. <example> <title>Getrusage pøíklad</title> <programlisting role="php"> $dat = getrusage(); echo $dat["ru_nswap"]; # poèet swapù echo $dat["ru_majflt"]; # poèet page faultù echo $dat["ru_utime.tv_sec"]; # vyuitý uivatelský èas (sekundy) echo $dat["ru_utime.tv_usec"]; # vyuitý uivatelský èas (mikrosekundy) </programlisting> </example> Dalí detaily viz man stránka getrusage(2) na vaem systému. </para> </refsect1> </refentry> <refentry id="function.ini-alter"> <refnamediv> <refname>ini_alter</refname> <refpurpose>Zmìnit hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_alter</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> <paramdef>string <parameter>newvalue</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Zmìní hodnotu konfiguraèní volby, vrátí <literal>false</literal> pøi selhání, a pøedchozí hodnotu konfiguraèní volby pøi úspìchu. </para> <note> <para> Toto je alias k <function>ini_set</function> </para> </note> <para> Viz také <function>ini_get</function>, <function>ini_restore</function>, <function>ini_set</function> </para> </refsect1> </refentry> <refentry id="function.ini-get"> <refnamediv> <refname>ini_get</refname> <refpurpose>Získat hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_get</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí hodnotu konfiguraèní volby pøi úspìchu, <literal>false</literal> pøi selhání. </para> <para> Viz také <function>ini_alter</function>, <function>ini_restore</function>, <function>ini_set</function> </para> </refsect1> </refentry> <refentry id="function.ini-restore"> <refnamediv> <refname>ini_restore</refname> <refpurpose>Obnovit pùvodní hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_restore</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Obnoví pùvodní hodnotu konfiguraèní volby. </para> <para> Viz také <function>ini_alter</function>, <function>ini_get</function>, <function>ini_set</function> </para> </refsect1> </refentry> <refentry id="function.ini-set"> <refnamediv> <refname>ini_set</refname> <refpurpose>Zmìnit hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_set</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> <paramdef>string <parameter>newvalue</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Zmìní hodnotu konfiguraèní volby, vrátí <literal>false</literal> pøi selhání, a pøedchozí hodnotu konfiguraèní volby pøi úspìchu. </para> <para> Viz také <function>ini_alter</function>, <function>ini_get</function>, <function>ini_restore</function> </para> </refsect1> </refentry> <refentry id="function.phpcredits"> <refnamediv> <refname>phpcredits</refname> <refpurpose>Vytisknout credits pro PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>phpcredits</function></funcdef> <paramdef>int <parameter>flag</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vytiskne credits vè. seznamu vývojáøù PHP, modulù, atd. Generuje pøísluný HTML kód, kterým se tyto informace vkládají do stránky. Je tøeba pøedat argument indikující co se vytiskne (pøeddefinovaná konstanta flag, viz níe). Napøíklad k vytitìní veobecných credits mùete nìkde ve svém kódu pouít: <informalexample> <programlisting role="php"> ... phpcredits(CREDITS_GENERAL); ... </programlisting> </informalexample> A pokud chcete vytisknout uí kruh vývojáøù a dokumentaèní skupinu na samostatné stránce, pouijte: <informalexample> <programlisting role="php"> <?php phpcredits(CREDITS_GROUP + CREDITS_DOCS + CREDITS_FULLPAGE); ?> </programlisting> </informalexample> A pokud chcete vloit vechny credits do vlastní stránky, pomùe vám následující kód: <informalexample> <programlisting role="php"> <html> <head> <title>Má stránka s credits</title> </head> <body> <?php // vá vlastní kód phpcredits(CREDITS_ALL + CREDITS_FULLPAGE); // dalí kód ?> </body> </html> </programlisting> </informalexample> </para> <para> </para> <para> <table> <title>Pøeddefinované <function>phpcredits</function> pøíznaky</title> <tgroup cols="2"> <thead> <row> <entry>název</entry> <entry>popis</entry> </row> </thead> <tbody> <row> <entry>CREDITS_ALL</entry> <entry> Vechny credits, ekvivalentní k: CREDITS_DOCS + CREDITS_GENERAL + CREDITS_GROUP + CREDITS_MODULES + CREDITS_FULLPAGE. Vygeneruje kompletní samostatnou HTML stránku s pøíslunými tagy. </entry> </row> <row> <entry>CREDITS_DOCS</entry> <entry>Credits dokumentaèního týmu</entry> </row> <row> <entry>CREDITS_FULLPAGE</entry> <entry> Obvykle se pouívá v kombinaci s jinými pøíznaky. Indikuje, e se má vytisknout kompletní samostatná HTML stránka, vèetnì informací indikovaných jinými pøíznaky. </entry> </row> <row> <entry>CREDITS_GENERAL</entry> <entry> Veobecné credits: Design a koncept jazyka, autoøi PHP 4.0 a SAPI modul. </entry> </row> <row> <entry>CREDITS_GROUP</entry> <entry>Seznam uího kruhu vývojáøù</entry> </row> <row> <entry>CREDITS_MODULES</entry> <entry>Seznam roziøujících modulù (extenzí) PHP a jejich autorù</entry> </row> <row> <entry>CREDITS_SAPI</entry> <entry>Seznam server API modulù PHP a jejich autorù</entry> </row> </tbody> </tgroup> </table> </para> <para> Viz také <function>phpinfo</function>, <function>phpversion</function>, <function>php_logo_guid</function>. </para> </refsect1> </refentry> <refentry id="function.phpinfo"> <refnamediv> <refname>phpinfo</refname> <refpurpose>Vytisknout spoustu informací o PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>phpinfo</function></funcdef> <paramdef>int <parameter><optional>what</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vytiskne velké mnoství informací o souèasném stavu PHP. To zahrnuje informace o kompilaèních volbách a extenzích, verzi PHP, informaci o serveru a systémù (pokud je PHP zkompilováno jako modul), PHP prostøedí, verzi OS, cesty, hlavní a lokální hodnoty konfiguraèních voleb, HTTP hlavièky, a PHP licenci. </para> <para> Výstup se dá upravit pøedáním jednou nebo více z následujících hodnot uloených ve volitelném argumentu <parameter>what</parameter>. <itemizedlist> <listitem><simpara>INFO_GENERAL</simpara></listitem> <listitem><simpara>INFO_CREDITS</simpara></listitem> <listitem><simpara>INFO_CONFIGURATION</simpara></listitem> <listitem><simpara>INFO_MODULES</simpara></listitem> <listitem><simpara>INFO_ENVIRONMENT</simpara></listitem> <listitem><simpara>INFO_VARIABLES</simpara></listitem> <listitem><simpara>INFO_LICENSE</simpara></listitem> <listitem><simpara>INFO_ALL</simpara></listitem> </itemizedlist> </para> <para> Viz také <function>phpversion</function>, <function>phpcredits</function>, <function>php_logo_guid</function> </para> </refsect1> </refentry> <refentry id="function.phpversion"> <refnamediv> <refname>phpversion</refname> <refpurpose>Získat souèasnou verzi PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>phpversion</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec obsahující verzi právì bìícího PHP parseru. <example> <title>phpversion() example</title> <programlisting role="php"> // prints e.g. 'Souèasná verze PHP: 3.0rel-dev' echo "Souèasná verze PHP: ".phpversion(); </programlisting> </example> </para> <para> Viz také <function>phpinfo</function>, <function>phpcredits</function>, <function>php_logo_guid</function> </para> </refsect1> </refentry> <refentry id="function.php-logo-guid"> <refnamediv> <refname>php_logo_guid</refname> <refpurpose>Get the logo guid</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>php_logo_guid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <note> <para> Tato funkcionalita byla pøidána v PHP 4 Beta 4. </para> </note> </para> <para> Viz také <function>phpinfo</function>. <function>phpversion</function>, <function>phpcredits</function> </para> </refsect1> </refentry> <refentry id="function.php-sapi-name"> <refnamediv> <refname>php_sapi_name</refname> <refpurpose> Vrátit typ rozhraní mezi web serverem a PHP Returns the type of interface between web server and PHP </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>php_sapi_name</function></funcdef> <void/> </funcprototype> </funcsynopsis> <simpara> <function>php_sapi_name</function> vrátí øetìzec popisující malými písmeny typ rozhraní mezi web serverem a PHP (Server API, SAPI). U CGI PHP je tento øetìzec "cgi", u mod_php pro Apache je tento øetìzec "apache" a tak dále. </simpara> <para> <example> <title><function>Php_sapi_name</function> Example</title> <programlisting role="php"> $sapi_type = php_sapi_name(); if ($sapi_type == "cgi") print "Pouíváte CGI PHP\n"; else print "Nepouíváte CGI PHP\n"; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.php-uname"> <refnamediv> <refname>php_uname</refname> <refpurpose> Vrátit informaci o operaèním systému, na kterém bylo PHP zkompilováno </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>php_uname</function></funcdef> <void/> </funcprototype> </funcsynopsis> <simpara> <function>php_uname</function> vrátí øetìzec s popisem operaèního systému, na kterém bylo PHP zkompilováno. </simpara> <para> <example> <title><function>php_uname</function> Example</title> <programlisting role="php"> if (substr(php_uname(), 0, 7) == "Windows") { die("Pardon, tento skript na Windows nefunguje.\n"); } </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.putenv"> <refnamediv> <refname>putenv</refname> <refpurpose>Nastavit hodnotu systémové promìnné</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>putenv</function></funcdef> <paramdef>string <parameter>setting</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pøidá <parameter>setting</parameter> do prostøedí serveru. </para> <para> <example> <title>Nastavení systémové promìnné</title> <programlisting role="php"> putenv ("UNIQID=$uniqid"); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.set-magic-quotes-runtime"> <refnamediv> <refname>set_magic_quotes_runtime</refname> <refpurpose> Nastavit souèasnou aktivní hodnotu magic_quotes_runtime </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>long <function>set_magic_quotes_runtime</function> </funcdef> <paramdef>int <parameter>new_setting</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Nastaví souèasnou aktivní konfiguraèní volby <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>. (0 vypnuto, 1 zapnuto) </simpara> <simpara> Viz také <function>get_magic_quotes_gpc</function>, <function>get_magic_quotes_runtime</function>. </simpara> </refsect1> </refentry> <refentry id="function.set-time-limit"> <refnamediv> <refname>set_time_limit</refname> <refpurpose>Omezit maximální dobu prùbìhu skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>set_time_limit</function></funcdef> <paramdef>int <parameter>seconds</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Urèí poèet sekund po které mùe skript bìet. Pokud je dosaeno tohoto èasu, skript vrátí fatální chybu. Standardní limit je 30 sekund, nebo, pokud existuje, hodnota direktivy max_execution_time definovaná v <link linkend="configuration.file">konfiguraèním souboru</link>. Pokud je <parameter>seconds<-parameter> nula, neexistuje ádný èasový limit. </simpara> <simpara> <function>set_time_limit</function> pøi svém zavolání restartuje èítaè èasu od nuly. Jinými slovy, pokud je limit standardních é sekund a po 25 sekundách provádìní skriptu dojde k volání set_time_limit(20), tento skript pobìí celkem 45 sekund pøedtím, ne skonèí na èasovém limitu. </simpara> <simpara> Vimnìte si, e <function>set_time_limit</function> nemá ádný úèinek, kdy PHP bìí v bezpeèném módu. Obejít to lz jedine vypnutím bezpeèného módu nebo zmìnou èasového limitu v <link linkend="configuration.file">konfiguraèním souboru</link>. </simpara> </refsect1> </refentry> <refentry id="function.zend-logo-guid"> <refnamediv> <refname>zend_logo_guid</refname> <refpurpose>Získat zend guid</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>zend_logo_guid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <note> <para> Tato funkcionalita byla pøidána v PHP 4 Beta 4. </para> </note> </para> </refsect1> </refentry> <refentry id="function.get-loaded-extensions"> <refnamediv> <refname>get_loaded_extensions</refname> <refpurpose> Vrátit pole se jmény vech zkompilovaných a naètených modulù (extenzí) </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_loaded_extensions</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrací jména vech modulù (extenzí) zkompilovaných a naètených do PHP interpretru. </para> <para> Napøíklad následující øádek <informalexample> <programlisting> print_r (get_loaded_extensions()); </programlisting> </informalexample> vypíe seznam podobný tomuto: <informalexample> <programlisting> Array ( [0] => xml [1] => wddx [2] => standard [3] => session [4] => posix [5] => pgsql [6] => pcre [7] => gd [8] => ftp [9] => db [10] => Calendar [11] => bcmath ) </programlisting> </informalexample> </para> <para> Viz také: <function>get_extension_funcs</function>. </para> </refsect1> </refentry> <refentry id="function.get-extension-funcs"> <refnamediv> <refname>get_extension_funcs</refname> <refpurpose> Vrátit pole jmen funkcí urèitého modulu </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_extension_funcs</function></funcdef> <paramdef>string <parameter>module_name</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrací jména vech funkcí definovaných v modulu urèeném argumentem <parameter>module_name</parameter>. </para> <para> Napøíklad následující øádky <informalexample> <programlisting> print_r (get_extension_funcs ("xml")); print_r (get_extension_funcs ("gd")); </programlisting> </informalexample> vytisknou seznam vech funkcí v modulech <varname>xml</varname> a <varname>gd</varname>. </para> <para> Viz také: <function>get_loaded_extensions</function> </para> </refsect1> </refentry> <refentry id="function.get-required-files"> <refnamediv> <refname>get_required_files</refname> <refpurpose> Vrátit pole jmen vech souborù, které byly v urèitém skriptu naèteny pomocí require_once() </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_required_files</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí asociativní pole jmen vech souborù, které byly naèteny do probíhajícího skriptu pomocí <function>require_once</function>. Indexy tohoto pole jsou názvy souborù pouitých v <function>require_once</function> bez pøípony ".php". </para> <para> Následující pøíklad <example> <title>Tisk require()ovaných a include()ovaných souborù</title> <programlisting> <?php require_once ("local.php"); require_once ("../inc/global.php"); for ($i=1; $i<5; $i++) include "util".$i."php"; echo "Required_once files\n"; print_r (get_required_files()); echo "Included_once files\n"; print_r (get_included_files()); ?> </programlisting> </example> vygeneruje následující výstup: <informalexample> <programlisting> Required_once files Array ( [local] => local.php [../inc/global] => /full/path/to/inc/global.php ) Included_once files Array ( [util1] => util1.php [util2] => util2.php [util3] => util3.php [util4] => util4.php ) </programlisting> </informalexample> </para> <para> <note> <para> Od verze PHP 4.0.1pl2 tato funkce pøedpokládá, e soubory v <varname>required_once</varname> konèí pøíponou ".php", jiné pøípony nefungují. </para> </note> </para> <para> Viz také: <function>require_once</function>, <function>include_once</function>, <function>get_included_files</function> </para> </refsect1> </refentry> <refentry id="function.get-included-files"> <refnamediv> <refname>get_included_files</refname> <refpurpose> Vrátit pole jmen vech souborù, které byly ve skriptu naèteny pomocí include_once() </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_included_files</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí asociativní pole jmen vech souborù, které byly naèteny do skriptu pomocí <function>include_once</function>. Indexy tohoto pole jsou názvy souborù pouitých v <function>include_once</function> bez pøípony ".php". </para> <para> <note> <para> Od verze PHP 4.0.1pl2 tato funkce pøedpokládá, e soubory v <varname>include_once</varname> konèí pøíponou ".php", jiné pøípony nefungují. </para> </note> </para> <para> Viz také: <function>require_once</function>, <function>include_once</function>, <function>get_required_files</function> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/mail.xml +++ phpdoc/cs/functions/mail.xml <reference id="ref.mail"> <title>Mail functions</title> <titleabbrev>Mail</titleabbrev> <partintro> <simpara> The <function>mail</function> function allows you to send mail.</simpara> </partintro> <refentry id="function.mail"> <refnamediv> <refname>mail</refname> <refpurpose>send mail</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>bool <function>mail</function></funcdef> <paramdef>string <parameter>to</parameter></paramdef> <paramdef>string <parameter>subject</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> <paramdef>string <parameter><optional>additional_headers</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Mail</function> automaticky odmailuje vzkaz specifikovaný v <parameter>message</parameter> pøíjemci specifikovanému v <parameter>to</parameter>. Pøidáním èárky mezi adresami v <parameter>to</parameter> mùete specifikovat více pøíjemcù. </simpara> <para> <example> <title>Odeslání mailu.</title> <programlisting> mail("rasmus@lerdorf.on.ca", "Mùj pøedmìt", "Øádek 1\nØádek 2\nØádek 3"); </programlisting> </example></para> <simpara> Pokud je pøedán ètvrtý argument, jeho hodnota se vloí na konec hlavièek. Toto se obvykle pouívá k pøidání extra hlavièek. If a fourth string argument is passed, this string is inserted at the end of the header. This is typically used to add extra headers. Vícenásobné hlavièky se oddìlují zaøádkováním.</simpara> <para> <example> <title>Odeslání mailu s extra hlavièkami.</title> <programlisting> mail("nobody@aol.com", "pøedmìt", $message, "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion()); </programlisting> </example> K vytvoøení komplexních emailù mùete také pouít pomìrnì jednoduché techniky pro tvorbu øetìzcù. <example> <title>Sending complex email.</title> <programlisting> /* recipients */ $recipient .= "Mary <mary@u.college.edu>" . ", " ; //vimnìte si èárky $recipient .= "Kelly <kelly@u.college.edu> . ", "; $recipient .= "ronabop@php.net"; /* subject */ $subject = "Birthday Reminders for August"; /* message */ $message .= "Následující email obsahuje formátovanou ASCII tabulku\n"; $message .= "Day \t\tMonth \t\tYear\n"; $message .= "3rd \t\tAug \t\t1970\n"; $message .= "17rd\t\tAug \t\t1973\n"; /* mùete pøidat signaturu */ $message .= "--\r\n"; //oddìlovaè signatury $message .= "Birthday reminder copylefted by public domain"; /* dodateèné hlavièky pro chyby, From, cc, bcc, atd */ $headers .= "From: Birthday Reminder <birthday@php.net>\n"; $headers .= "X-Sender: <birthday@php.net>\n"; $headers .= "X-Mailer: PHP\n"; // mailový klient $headers .= "X-Priority: 1\n"; // Urgentní vzkaz! $headers .= "Return-Path: <birthday@php.net>\n"; // Návratová cesta pro chyby /* Pokud chcete poslat HTML email, odkomentujte následující øádek */ // $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime typ $headers .= "cc:birthdayarchive@php.net\n"; // CC $headers .= "bcc:birthdaycheck@php.net, birthdaygifts@php.net\n"; // BCC /* a teï to odeleme */ mail($recipient, $subject, $message, $headers); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.ezmlm-hash"> <refnamediv> <refname>ezmlm_hash</refname> <refpurpose>Poèítá hash hodnotu potøebnou pro EZMLM</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ezmlm_hash</function></funcdef> <paramdef>string <parameter>addr</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>ezmlm_hash</function> Poèítá hash hodnotu, která je potøeba pro uchovávání EZMLM mailing listù v MySQL databázi. </simpara> <para> <example> <title>Výpoèet hashe a pøihláení uivatele</title> <programlisting> $user = "kris@koehntopp.de"; $hash = ezmlm_hash ($user); $query = sprintf ("INSERT INTO sample VALUES (%s, '%s')", $hash, $user); $db->query($query); // pouito databázové rozhraní PHPLIB </programlisting> </example> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/misc.xml +++ phpdoc/cs/functions/misc.xml <reference id="ref.misc"> <title>Smíené funkce</title> <titleabbrev>Smíené</titleabbrev> <partintro> <para> Tyto funkce byly umístìny zde, protoe nespadají do ádné jiné kategorie. </para> </partintro> <refentry id="function.connection-aborted"> <refnamediv> <refname>connection_aborted</refname> <refpurpose>Vrací true, pokud se klient odpojil</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>connection_aborted</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí true, pokud se klient odpojil. Úplné vysvìtlení viz popis v <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link>. </simpara> </refsect1> </refentry> <refentry id="function.connection-status"> <refnamediv> <refname>connection_status</refname> <refpurpose>Vrací bitové pole stavu spojení</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>connection_status</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrací bitové pole stavu spojení. Úplné vysvìtlení viz popis v <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link>. </simpara> </refsect1> </refentry> <refentry id="function.connection-timeout"> <refnamediv> <refname>connection_timeout</refname> <refpurpose>Return true if script timed out</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>connection_timeout</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns true if script timed out. Úplné vysvìtlení viz popis v <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link>. </simpara> </refsect1> </refentry> <refentry id="function.define"> <refnamediv> <refname>define</refname> <refpurpose>Definuje pojmenovanou konstantu.</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>define</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> <paramdef>int <parameter><optional>case_insensitive</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Definuje pojmenovanou konstantu, která je podobná promìnné s výjimkou toho, e: <itemizedlist> <listitem> <simpara> Konstanty nemají znak dolaru ('$') pøed jménem; </simpara> </listitem> <listitem> <simpara> Konstanty jsou dostupné odkudkoliv bez ohledu na pravidla rozsahu platnosti promìnných; </simpara> </listitem> <listitem> <simpara> Konstanty se nedají pøedefinovávat a ruit; a </simpara> </listitem> <listitem> <simpara> Konstanty se mohou nabývat pouze skalárních hodnot. </simpara> </listitem> </itemizedlist> </para> <para> Název konstanty je dán argumentem <parameter>name</parameter>; hodnota je dána argumentem <parameter>value</parameter>. </para> <para> Dále je dostupný volitelní tøetí argument <parameter>case_insensitive</parameter>. Pokud má hodnotu <emphasis>1</emphasis>, konstanta bude definována case-insensitive. Výchozí chování je case-sensitive; tj. CONSTANT and Constant reprezentují rùzné hodnoty. </para> <para> <example> <title>Definování konstant</title> <programlisting role="php"> <?php define ("CONSTANT", "Hello world."); echo CONSTANT; // výstup je "Hello world." ?> </programlisting> </example> </para> <para> <function>Define</function> vrací TRUE pøi úspìchu a FALSE pokud dojde k chybì. </para> <para> Viz také <function>defined</function> a sekci <link linkend="language.constants">Konstanty</link>. </para> </refsect1> </refentry> <refentry id="function.defined"> <refnamediv> <refname>defined</refname> <refpurpose> Zkontroluje, jestli existuje daná pojmenovaná konstanta </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>defined</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací true, pokud byla definována pojmenovaná konstanta daná argumentem <parameter>name</parameter>, jinak false. <example> <title>Kontrola konstant</title> <programlisting role="php"> <?php if (defined("CONSTANT")){ // název konstanty by mìl být v uvozovkách echo CONSTANT; // } ?> </programlisting> </example> </para> <para> Viz také <function>define</function> a sekci <link linkend="language.constants">Konstanty</link>. </para> </refsect1> </refentry> <refentry id="function.die"> <refnamediv> <refname>die</refname> <refpurpose> Vytiskne vzkaz a ukonèí souèasný skript </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>die</function></funcdef> <paramdef>string <parameter>message</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Tento jazykový konstrukt vytiskne vzkaz a ukonèí parsování skriptu. Nemá návratovou hodnotu. </simpara> <para> <example> <title>die example</title> <programlisting role="php"> <?php $filename = '/path/to/data-file'; $file = fopen ($filename, 'r') or die("nepodaøilo se otevøít soubor ($filename)"); ?> </programlisting> </example> </para> <simpara> Viz také <function>exit</function>. </simpara> </refsect1> </refentry> <refentry id="function.eval"> <refnamediv> <refname>eval</refname> <refpurpose>Vyhodnotí øetìzec jako PHP kód</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>eval</function></funcdef> <paramdef>string <parameter>code_str</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>eval</function> vyhodnotí øetìzec pøedaný v <parameter>code_str</parameter> jako PHP kód. Kromì jiného se dá vyuít na ukládání kódu v textovém sloupci databáze pro pozdìjí vykonání. </simpara> <simpara> Pøi pouívání <function>eval</function> byste mìli mít na pamìti nìkolik faktorù. Pamatujte si, e pøedávaný øetìzec musí být platný PHP kód, vèetnì vìcí jako ukonèování výrazù støedníkem, aby parser nezemøel na øádku po <function>eval</function>, a øádné escapování v <parameter>code_str</parameter>. </simpara> <simpara> Také pamatujte, ze hodnoty pøiøazené promìnným v <function>eval</function> tìmto promìnným zùstanou i v hlavním skriptu. </simpara> <simpara> Výraz <literal>return</literal> okamitì ukonèí vyhodnocování pøedaného øetìzce. V PHP 4 mùete pouít <literal>return</literal> k vrácení hodnoty, která se stane výsledkem <function>eval</function> funkce, zatímco v PHP 3 byl <function>eval</function> typu <literal>void</literal> nic nevracel. </simpara> <para> <example> <title> <function>Eval</function> pøíklad - jednoduché spojení textù </title> <programlisting role="php"> <?php $string = 'cup'; $name = 'coffee'; $str = 'This is a $string with my $name in it.<br>'; echo $str; eval ("\$str = \"$str\";"); echo $str; ?> </programlisting> </example> </para> <para> Výe uvedený pøíklad ukáe: <programlisting> This is a $string with my $name in it. This is a cup with my coffee in it. </programlisting> </para> </refsect1> </refentry> <refentry id="function.exit"> <refnamediv> <refname>exit</refname> <refpurpose>Ukonèí souèasný skript</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>exit</function></funcdef> <void/> </funcprototype> </funcsynopsis> <simpara> Tento jazykový konstrkut ukonèí parsování skriptu. Nevrací ádnou hodnotu. </simpara> <simpara> Viz také <function>die</function>. </simpara> </refsect1> </refentry> <refentry id="function.get-browser"> <refnamediv> <refname>get_browser</refname> <refpurpose> Urèuje schopnosti uivatelova browseru </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>object <function>get_browser</function></funcdef> <paramdef>string <parameter><optional>user_agent</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> <function>get_browser</function> se pokusí urèit schopnosti uivatelova browseru. Toho je dosaeno vyhledáním informací o browseru v souboru <filename>browscap.ini</filename>. Standardne se pouije $HTTP_USER_AGENT; nicménì, mùete to zmìnit (tj. vyhledat informace o jiném browseru) pøedáním volitelného argumentu <parameter>user_agent</parameter>. </simpara> <simpara> Informace se vracejí jako objekt, který obsahuje rùzné datové elementy, které reprezentují napøíklad hlavní a vedlejí èíslo verze a ID øetìzec; true/false hodnoty vlastností jako podpora rámcù, JavaScript a cookies, atd. </simpara> <simpara> Jakkoli <filename>browscap.ini</filename> obsahuje informace o mnoha browserech, aktuálnost databáze závisí na uivatelských updatech. Formát souboru je pomìrnì snadno pochopitelný. </simpara> <para> Následující pøíklad ukazuje, jak by se daly vypsat vechny informace získané o uivatelovì browseru. <example> <title><function>Get_browser</function> pøíklad</title> <programlisting role="php"> <?php function list_array ($array) { while (list ($key, $value) = each ($array)) { $str .= "<b>$key:</b> $value<br>\n"; } return $str; } echo "$HTTP_USER_AGENT<hr>\n"; $browser = get_browser(); echo list_array ((array) $browser); ?> </programlisting> </example> </para> <simpara> Výstup z výe uvedeného skriptu by vypadal asi takto: </simpara> <programlisting> Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr> <b>browser_name_pattern:</b> Mozilla/4\.5.*<br> <b>parent:</b> Netscape 4.0<br> <b>platform:</b> Unknown<br> <b>majorver:</b> 4<br> <b>minorver:</b> 5<br> <b>browser:</b> Netscape<br> <b>version:</b> 4<br> <b>frames:</b> 1<br> <b>tables:</b> 1<br> <b>cookies:</b> 1<br> <b>backgroundsounds:</b> <br> <b>vbscript:</b> <br> <b>javascript:</b> 1<br> <b>javaapplets:</b> 1<br> <b>activexcontrols:</b> <br> <b>beta:</b> <br> <b>crawler:</b> <br> <b>authenticodeupdate:</b> <br> <b>msn:</b> <br> </programlisting> <simpara> Aby to fungovalo, <link linkend="ini.sect.browscap">browscap</link> direktiva ve vaem konfiguraèním souboru musí ukazovat na platné umístìní <filename>browscap.ini</filename> souboru. </simpara> <simpara> Pro dalí informace (vèetnì lokací na kterých mùete získat <filename>browscap.ini</filename> soubor) viz PHP FAQ na <ulink url="&url.php.faq;">&url.php.faq;</ulink>. </simpara> </refsect1> </refentry> <refentry id="function.highlight-file"> <refnamediv> <refname>highlight_file</refname> <refpurpose>Zvýrazní syntaxi souboru</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>highlight_file</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>highlight_file</function> vytiskne barevnì zvýraznìnou syntaxi kódu obsaeného ve <parameter>filename</parameter> s pouitím barev definovaných ve zvýrazòovaèi syntaxe zabudovaném v PHP. Vrací true pøi úspìchu, jinak false (PHP 4). </simpara> <para> <example> <title>Tvorba URL zvyrazòující syntaxi</title> <simpara> K vytvoøení URL, která zvýrazní syntaxi jakéhokoliv skriptu, který jí pøedáte vyuijeme "ForceType" direktivu Apache k vytvoøení hezkého vzorce URL, and pomocí funkce <function>highlight_file</function> vypíeme hezky vypadající výpis kódu. </simpara> <simpara> Do svého httpd.conf pøidejte následující: </simpara> <para> <informalexample><programlisting> <Location /source> ForceType application/x-httpd-php </Location> </programlisting></informalexample> </para> <simpara> A potom vytvoøte soubor pojmenovaný "source", a umístìte ho do svého web root adresáøe. </simpara> <para> <programlisting role="php"> <HTML> <HEAD> <TITLE>Zobrazení zdroje</TITLE> </HEAD> <BODY BGCOLOR="white"> <?php $script = getenv ("PATH_TRANSLATED"); if(!$script) { echo "<BR><B>CHYBA: Je potøeba název skriptu!</B><BR>"; } else { if (ereg("(\.php|\.inc)$",$script)) { echo "<H1>Zdroj souboru: $PATH_INFO</H1>\n<HR>\n"; highlight_file($script); } else { echo "<H1>CHYBA: Povoleny jsou pouze soubory s pøíponou .php nebo .inc!</H1>"; } } echo "<HR>Zpracováno: ".date("Y/M/d H:i:s",time()); ?> </BODY> </HTML> </programlisting> </para> <simpara> Potom mùete pouít URL jako je ta níe k zobrazení obarvené verze skriptu umístìné v "/path/to/script.php" na vaem webu. </simpara> <para> <informalexample> <programlisting> http://your.server.com/source/path/to/script.php </programlisting> </informalexample> </para> </example> </para> <simpara> Viz také <function>highlight_string</function>, <function>show_source</function>. </simpara> </refsect1> </refentry> <refentry id="function.highlight-string"> <refnamediv> <refname>highlight_string</refname> <refpurpose>Zvýraznìní syntaxe øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>highlight_string</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>highlight_string</function> vytiskne barevnì zvýraznìnou verzi <parameter>str</parameter> s pouitím barev definovaných ve zvýrazòovaèi syntaxe zabudovaném v PHP. Vrací true pøi úspìchu, jinak false (PHP 4). </simpara> <simpara> Viz také <function>highlight_file</function>, <function>show_source</function>. </simpara> </refsect1> </refentry> <refentry id="function.ignore-user-abort"> <refnamediv> <refname>ignore_user_abort</refname> <refpurpose> Nastavuje, jestli má ukonèení spojení klientem pøeruit vykonávání skriptu </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ignore_user_abort</function></funcdef> <paramdef>int <parameter><optional>setting</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> Tato funkce nastavuje, jestli má odpojení klienta zpùsobit ukonèení skriptu. Vrací pøedchozí nastavení, a pøi zavolání bez argumentu souèasné nastavení nemìní, pouze ho vrací. Úplné vysvìtlení viz popis v sekci <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link> </simpara> </refsect1> </refentry> <refentry id="function.iptcparse"> <refnamediv> <refname>iptcparse</refname> <refpurpose> Parsuje binární IPTC <ulink url="&url.iptc;">&url.iptc;</ulink> blok do jednotlivých tagù. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>iptcparse</function></funcdef> <paramdef>string <parameter>iptcblock</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Tato funkce parsuje binární IPTC blok do jeho jednotlivých tagù. Vrací pole, které pouívá tagmarker jako index, a jeho hodnotu jako hodnotu. Vrací false pøi chybì, nebo pokud nenajde ádná IPTC data. Pøíklad viz <function>GetImageSize</function>. </simpara> </refsect1> </refentry> <refentry id="function.leak"> <refnamediv> <refname>leak</refname> <refpurpose>Nenávratnì alokuje pamìt</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>leak</function></funcdef> <paramdef>int <parameter>bytes</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Leak</function> nenávratnì alokuje specifikované mnoství pamìti. </simpara> <simpara> Tato funkce je uiteèná pøi ladìní správce pamìti, který automaticky èistí "vyteklou" (leaked) pamìt pøi dokonèení kadého poadavku. </simpara> </refsect1> </refentry> <refentry id="function.pack"> <refnamediv> <refname>pack</refname> <refpurpose>Sbalí data do binárního øetìzce.</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>pack</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed <parameter><optional>args</optional></parameter> ... </paramdef> </funcprototype> </funcsynopsis> <para> Sbalí pøedané argumenty do binárního øetìzce podle argumentu <parameter>format</parameter>. Vrací binární øetìzec obsahující pøedaná data. </para> <para> Nápad na tuto funkci byl pøevzat z Perlu, a vechny formátovací kódy fungují stejnì jako tam, nicménì, nìkteré formátovací kódy chybí, jako napøíklad Perlovský formátovací kód "u". Formátovací øetìzec sestává z formátovacích kódu následovaných volitelným opakovacím argumentem. Opakovací argument mùe být buï celoèíselná hodnota, nebo * pro opakování do konce vstupních dat. U a, A, h, H poèet opakování urèuje, kolik znakù se vezme z jednoho datového argumentu, u @ je to absolutní pozice, kde se mají umístit dalí data, u veho ostatního poèet opakování urèuje, kolik datových argumentù se spotøebuje a sbalí do výsledného binárního øetìzce. V souèasnosti jsou implementovány <itemizedlist> <listitem> <simpara> a øetìzec doplnìný NUL hodnotami </simpara> </listitem> <listitem> <simpara> A øetìzec doplnìný SPACE hodnotami </simpara> </listitem> <listitem> <simpara> h Hex øetìzec, spodní slabika první </simpara> </listitem> <listitem> <simpara> H Hex øetìzec, horní slabika první </simpara> </listitem> <listitem> <simpara> c signed char </simpara> </listitem> <listitem> <simpara> C unsigned char </simpara> </listitem> <listitem> <simpara> s signed short (vdy 16 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> S unsigned short (vdy 16 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> n unsigned short (vdy 16 bitù, big endian byte order) </simpara> </listitem> <listitem> <simpara> v unsigned short (vdy 16 bitù, little endian byte order) </simpara> </listitem> <listitem> <simpara> i signed integer (velikost a poøadí bytù závislá na systému) </simpara> </listitem> <listitem> <simpara> I unsigned integer (velikost a poøadí bytù závislá na systému) </simpara> </listitem> <listitem> <simpara> l signed long (vdy 32 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> L unsigned long (vdy 32 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> N unsigned long (vdy 32 bitù, big endian byte order) </simpara> </listitem> <listitem> <simpara> V unsigned long (vdy 32 bitù, little endian byte order) </simpara> </listitem> <listitem> <simpara> f float (velikost a reprezentace závislá na systému) </simpara> </listitem> <listitem> <simpara> d double (velikost a reprezentace závislá na systému) </simpara> </listitem> <listitem> <simpara> x NUL byte </simpara> </listitem> <listitem> <simpara> X Back up one byte </simpara> </listitem> <listitem> <simpara> @ NUL-fill to absolute position </simpara> </listitem> </itemizedlist> <example> <title><function>Pack</function> formátovací øetìzec</title> <programlisting role="php"> $binarydata = pack ("nvc*", 0x1234, 0x5678, 65, 66); </programlisting> <para> Výsledný binární øetìzec bude 6 bytù dlouhý, a bude obsahovat bytovou sekvenci 0x12, 0x34, 0x78, 0x56, 0x41, 0x42. </para> </example> </para> <para> Vimnìte si, e rozdíl mezi hodnotami se znaménkem a bez znaménka ovlivòuje pouze funkci <function>unpack</function>, zatímco funkce <function>pack</function> dává stejný výsledek pro formátovací kódy se znaménkem i bez znaménka. </para> <para> Dále si vimnìte, e PHP internì ukládá celoèíselné hodnoty jako hodnoty se znaménkem o velikosti závislé na systému. Pokud zadáte hodnotu bez znaménka, která bude pøíli velká, ne aby se dala takto uloit, pøevede se na double, co èasto vytváøí neádoucí výsledky. </para> </refsect1> </refentry> <refentry id="function.show-source"> <refnamediv> <refname>show_source</refname> <refpurpose>Zvýrazní syntaxi souboru</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>show_source</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>show_source</function> vytiskne barevnì zvýraznìnou syntaxi kódu obsaeného ve <parameter>filename</parameter> s pouitím barev definovaných ve zvýrazòovaèi syntaxe zabudovaném v PHP. Vrací true pøi úspìchu, jinak false (PHP 4). </simpara> <note> <simpara> Tato funkce je alias funkce <function>highlight_file</function> </simpara> </note> <simpara> Viz také <function>highlight_string</function>, <function>highlight_file</function>. </simpara> </refsect1> </refentry> <refentry id="function.sleep"> <refnamediv> <refname>sleep</refname> <refpurpose>Odloí provedení</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>sleep</function></funcdef> <paramdef>int <parameter>seconds</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce sleep odkládá provedení programu o poèet sekund pøedaný v argumentu <parameter>seconds</parameter>. </simpara> <simpara> Viz také <function>usleep</function>. </simpara> </refsect1> </refentry> <refentry id="function.uniqid"> <refnamediv> <refname>uniqid</refname> <refpurpose>Generatuje unikátní id</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>uniqid</function></funcdef> <paramdef>string <parameter>prefix</parameter></paramdef> <paramdef>boolean <parameter><optional>lcg</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Uniqid</function> vrací unikátní identifikátor zaloený na souèasném èase v mikrosekundách, opatøený prefixem. Prefix mùe být uiteèný napøíklad pokud generujete identifikátory na nìkolika serverech souèasnì, které by mohly vygenerovat identifikátor ve stejnou mikrosekundu. <parameter>Prefix</parameter> mùe být a 114 znakù dlouhý. </simpara> <simpara> Pokud je volitelný argument <parameter>lcg</parameter> true, <function>uniqid</function> pøidá dodateènou "kombinovanou LCG" entropii na konec své návratové hodnoty, co by mìlo uèinit výsledky jetì unikátnìjími. </simpara> <simpara> Pokud je <parameter>prefix</parameter> prázdný, vrácený øetìec bude 13 znakù dlouhý. Pokud je <parameter>lcg</parameter> true, bude dlouhý 23 znakù. </simpara> <note> <simpara> <parameter>lcg</parameter> argument je pøístupný pouze v PHP 4 and PHP 3.0.13 a vyích. </simpara> </note> <para> Pokud potøebujete unikátní identifikátor nebo symbol, a zamýlíte pøedat tento symbol uivateli po síti (napø. session cookies), doporuèujeme pouít nìco jako <informalexample> <programlisting role="php"> $token = md5 (uniqid ("")); // no random portion $better_token = md5 (uniqid (rand())); // better, difficult to guess </programlisting> </informalexample> </para> <simpara> Toto vytvoøí 32znakový identifikátor (128bitové hexa èíslo), které se extrémnì teko pøedpovídá. </simpara> </refsect1> </refentry> <refentry id="function.unpack"> <refnamediv> <refname>unpack</refname> <refpurpose>Rozbalí data z binárního øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>unpack</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>string <parameter>data</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Unpack</function> rozbalí data z binárního øetìzce do pole podle <parameter>format</parameter>. Vrací pole obsahující rozbalené prvky binárního øetìzce. </para> <para> <function>Unpack</function> funguje trochu jinak ne v Perlu, jeliko rozbalená data jsou uloena v asociativním poli. Toho dosáhnete tak, e vyjmenujete rùzné formátovací kódy a oddìlíte je lomítkem /. <example> <title><function>Unpack</function> format string</title> <programlisting role="php"> $array = unpack ("c2chars/nint", $binarydata); </programlisting> <para> Výsledné pole obsahuej poloky "chars1", "chars2" and "int". </para> </example> </para> <para> Vysvìtlení formátovacích kódù viz také: <function>pack</function> </para> <para> Vimnìte si, e PHP internì ukládá celoèíselné hodnoty se znaménkem. Pokud rozbalíte velkou celoèíselnou hodnotu bez znaménka a ta má stejnou velikost jako hodnoty internì ukládané PHP, výsledkem bude negativní èíslo, i kdy bylo zadáno rozbalování bez znaménka. </para> </refsect1> </refentry> <refentry id="function.usleep"> <refnamediv> <refname>usleep</refname> <refpurpose>Odloí provedení v mikrosekundách</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>usleep</function></funcdef> <paramdef>int <parameter>micro_seconds</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>usleep</function> odloí provedení skriptu o daný poèet <parameter>micro_seconds</parameter>. </simpara> <simpara> Viz také <function>sleep</function>. </simpara> <note> <simpara> Tato funkce nefunguje na Windows systémech. </simpara> </note> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/readline.xml +++ phpdoc/cs/functions/readline.xml <reference id="ref.readline"> <title>GNU Readline</title> <titleabbrev>Readline</titleabbrev> <partintro> <simpara> <function>readline</function> funkce implementují rozhraní ke GNU Readline knihovnì. Tyto funkce poskytují editovatelné pøíkazové øádky. Pøíkladem mùe být zpùsob, jakým vám Bash umoòuje vkládat znaky nebo listovat historií pøíkazù pomocí kláves pro pohyb kurzoru. Z interaktivní povahy této knihovny vyplývá, e není pøíli uiteèná pro psaní webových aplikací, ale mùe být uiteèná pøi psaní skriptù, které se mají spoutìt z pøíkazové øádky. </simpara> <simpara> Domovskou stránkou GNU Readline projektu je <ulink url="&url.readline;">&url.readline;</ulink>. Udruje jej Chet Ramey, který je také autorem Bashe. </simpara> </partintro> <refentry id="function.readline"> <refnamediv> <refname>readline</refname> <refpurpose>Pøeèíst øádek</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>readline</function></funcdef> <paramdef>string <parameter><optional>prompt</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí jeden øádek od uivatele. Mùete specifikovat øetìzec, který se má uivateli zobrazit jako výzva. Z vráceného øádku je odstranìna sekvence konce øádku. Do historie tento øádek musíte pøidat sami pomocí <function>readline_add_history</function>. </para> <example> <title><function>Readline</function></title> <programlisting role="php"> //ziska 3 prikazy uzivatele for ($i=0; $i < 3; $i++) { $line = readline ("Command: "); readline_add_history ($line); } //vypise historii print_r (readline_list_history()); //vypise promenne print_r (readline_info()); </programlisting> </example> </refsect1> </refentry> <refentry id="function.readline-add-history"> <refnamediv> <refname>readline_add_history</refname> <refpurpose>Pøidat øádek do historie</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>readline_add_history</function></funcdef> <paramdef>string <parameter>line</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce pøidá øádek do historie pøíkazové øádky.</para> </refsect1> </refentry> <refentry id="function.readline-clear-history"> <refnamediv> <refname>readline_clear_history</refname> <refpurpose>Smazat historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_clear_history</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce smae celou historii pøíkazové øádky.</para> </refsect1> </refentry> <refentry id="function.readline-completion-function"> <refnamediv> <refname>readline_completion_function</refname> <refpurpose>Zaregistrovat dokonèující funkci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_completion_function</function> </funcdef> <paramdef>string <parameter>line</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce zaregistruje dokonèující funkci. Musíte zadat název existující funkce, která pøijímá èásteèný pøíkaz a vrací pole moných protìjkù. Toto je stejná funkcionalita jakou dostanete, pokud v Bashi zmáèknete klávesu tab. </para> </refsect1> </refentry> <refentry id="function.readline-info"> <refnamediv> <refname>readline_info</refname> <refpurpose>Zjistit/nastavit rùzné interní promìnné readline</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>readline_info</function></funcdef> <paramdef>string <parameter><optional>varname</optional></parameter> </paramdef> <paramdef>string <parameter><optional>newvalue</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Pøi volání bez argumentù tato funkce vrátí pole hodnot pro vechna nastavení, která readline pouívá. Prvky jsou indexovány podle následujících hodnot: done, end, erase_empty_line, library_version, line_buffer, mark, pending_input, point, prompt, readline_name a terminal_name. </para> <para> Pøi volání s jedním argumentem vrátí hodnotu tohoto nastavení. Pøi volání se dvìma argumenty se nastavení zmení na danou hodnotu. </para> </refsect1> </refentry> <refentry id="function.readline-list-history"> <refnamediv> <refname>readline_list_history</refname> <refpurpose>Vypsat historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>readline_list_history</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí pole celé historie pøíkazové øádky. Prvky jsou indexovány integery, poèínaje nulou. </para> </refsect1> </refentry> <refentry id="function.readline-read-history"> <refnamediv> <refname>readline_read_history</refname> <refpurpose>Vrátit historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_read_history</function> </funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce pøeète historii pøíkazové øádky ze souboru.</para> </refsect1> </refentry> <refentry id="function.readline-write-history"> <refnamediv> <refname>readline_write_history</refname> <refpurpose>Zapsat historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_write_history</function> </funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce zapíe historii pøíkazové øádky do souboru.</para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/recode.xml +++ phpdoc/cs/functions/recode.xml <reference id="ref.recode"> <title>GNU Recode funkce</title> <titleabbrev>Recode</titleabbrev> <partintro> <para> Tento modul obsahuje rozhraní ke GNU Recode knihovnì, verze 3.5. Pokud cchete pouívat funkce definované v tomto modulu, musíte zkompilovat vá PHP interpretr s --with-recode. K tomu potøebujete mít na svém systému nainstalovanou GNU Recode 3.5 nebo vyí. </para> <para> GNU Recode knihovna konvertuje soubory mezi rùznými znakovými sadami a kódováními. Kdy nelze dosáhnout pøesné konverze, mùe se uchýlit k approximacím. Tato knihovna rozeznává nebo produkuje témìø 150 rùzných znakových sad, a je schopná konvertovat soubory mezi témìø libovolným párem. Podporuje vìtinu znakových sad z RFC 1345. </para> </partintro> <refentry id="function.recode-string"> <refnamediv> <refname>recode_string</refname> <refpurpose>Pøekóduje øetìzec podle poadavku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>recode_string</function></funcdef> <paramdef>string <parameter>request</parameter></paramdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pøekóduje øetìzec <parameter>string</parameter> podle poadavku <parameter>request</parameter>. Vrací pøekódovaný øetìzec nebo FALSE, pokud nebylo moné provést poadavek na pøekódování. </para> <para> Jednoduchý poadavek na pøekódování mùe být "lat1..iso646-de". Detailní instrukce k poadavkùm viz GNU Recode dokumentaci u vaí instalace. <example> <title>Základní <function>recode_string</function> pøíklad:</title> <programlisting role="php"> print recode_string ("us..flat", "Následující znak má diakritické znaménko: &aacute;"); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.recode"> <refnamediv> <refname>recode</refname> <refpurpose>Pøekóduje øetìzec podle poadavku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>recode_string</function></funcdef> <paramdef>string <parameter>request</parameter></paramdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <note> <simpara> Toto je alias k <function>recode_string</function>. Byl pøidán v PHP 4. </simpara> </note> </refsect1> </refentry> <refentry id="function.recode-file"> <refnamediv> <refname>recode_file</refname> <refpurpose> Pøekóduje soubor na soubor podle poadavku </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>recode_file</function></funcdef> <paramdef>string <parameter>request</parameter></paramdef> <paramdef>resource <parameter>input</parameter></paramdef> <paramdef>resource <parameter>output</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pøekóduje soubor odkazovaný deskriptorem <parameter>input</parameter> do souboru odkazovaném deskriptorem <parameter>output</parameter> podle poadavku <parameter>request</parameter>. Pokud se nepodaøilo poadavek provést, vrací FALSE, jinak TRUE. </para> <para> Tato funkce v souèasnosti nezpracovává deskriptory odkazující na vzdálené soubory (URL). Oba deskriptory musí ukazovat na místní soubory. </para> <para> <example> <title>Základní pøíklad <function>recode_file</function></title> <programlisting role="php"> $input = fopen ('input.txt', 'r'); $output = fopen ('output.txt', 'w'); recode_file ("us..flat", $input, $output); </programlisting> </example> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/strings.xml +++ phpdoc/cs/functions/strings.xml <reference id="ref.strings"> <title>Funkce pro práci s øetìzci</title> <titleabbrev>Øetìzce</titleabbrev> <partintro> <simpara> Vechny tyto funkce rùznými zpùsoby pracují s øetìzci. Nìkteré specializovanìjí funkce najdete v sekcích regulárních výrazù a manipulace s URL. </simpara> <para> Informace o chování øetìzcù, zvlátì v souvislosti s pouitím jednoduchých uvozovek, dvojitých uvozovek a escape sekvencí viz poloku <link linkend="language.types.string">Øetìzce</link> v sekci <link linkend="language.types">Typy</link> tohoto manuálu. </para> </partintro> <refentry id="function.addcslashes"> <refnamediv> <refname>AddCSlashes</refname> <refpurpose>Opatøit øetìzec lomítky ve stylu jazyka C</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>addcslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>charlist</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec se zpìtnými lomítky pøed znaky, které jsou vypsány v argumentu <parameter>charlist</parameter>. XXX Excapes <literal>\n</literal>, <literal>\r</literal> atd. podobnì jako v C, znaky s ASCII kódem niím ne 32 a vyím ne 126 se pøevedou na osmièkovou reprezentaci. V <parameter>charlist</parameter> mùete udat rozsah, napø. "\0..\37", co by XXX escapovao vechny znaky s ASCII kódem mezi 0 a 31. <example> <title>Ukázka <function>Addcslashes</function></title> <programlisting role="php"> $escaped = addcslashes ($not_escaped, "\0..\37!@\177..\377"); </programlisting> </example> <note> <simpara> Pøidáno v PHP4b3-dev.</simpara> </note> </para> <para> Viz také <function>stripcslashes</function>, <function>stripslashes</function>, <function>htmlspecialchars</function>, <function>htmlspecialchars</function> a <function>quotemeta</function>. </para> </refsect1> </refentry> <refentry id="function.addslashes"> <refnamediv> <refname>AddSlashes</refname> <refpurpose>Opatøit øetìzec lomítky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>addslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec se zpìtnými lomítky pøed znaky, které potøebují XXX be quoted v databázových dotazech apod. Tyto znaky jsou jednoduchá uvozovka (<literal>'</literal>), dvojitá uvozovka (<literal>"</literal>), zpìtné lomítko (<literal>\</literal>) a NUL (null byte). </para> <para> Viz také <function>stripslashes</function>, <function>htmlspecialchars</function> a <function>quotemeta</function>. </para> </refsect1> </refentry> <refentry id="function.bin2hex"> <refnamediv> <refname>bin2hex</refname> <refpurpose>Pøevést binární data na hexadecimální reprezentaci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bin2hex</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí ASCII øetìec obsahující hexadecimální reprezentaci <parameter>str</parameter>. Konverze probíhá po bytech, horní slabika první. </para> </refsect1> </refentry> <refentry id="function.chop"> <refnamediv> <refname>Chop</refname> <refpurpose>Odstranit netisknutelné znaky z konce øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>chop</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí pøedaný øetìzec bez netisknutelných znakù (vè. koncù øádku) na konci. <example> <title>Ukázka <function>Chop</function></title> <programlisting role="php"> $trimmed = chop ($line); </programlisting> </example> </para> <note> <para> <function>chop</function> se lií do Perlovské funkce <parameter>chop()</parameter>, která z øetìzce odstraòuje poslední znak. </para> </note> <para> Viz také <function>trim</function>, <function>ltrim</function>, <function>rtrim</function>, a <function>chop</function>. </para> </refsect1> </refentry> <refentry id="function.chr"> <refnamediv> <refname>Chr</refname> <refpurpose>Vrátit urèitý znak</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>chr</function></funcdef> <paramdef>int <parameter>ascii</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec jednoho znaku obsahující znak specifikovaný argumentem <parameter>ascii</parameter>. <example> <title>Ukázka <function>Chr</function></title> <programlisting role="php"> $str .= chr (27); /* pøidá escape znak na konec $str */ /* Toto je vìtinou uiteènìjí */ $str = sprintf ("Øetìzec konèi escape znakem: %c", 27); </programlisting> </example> Tato funkce se doplòuje s funkcí <function>ord</function>. Viz také <function>sprintf</function> s formátovacím øetìzcem <literal>%c</literal>. </para> </refsect1> </refentry> <refentry id="function.chunk-split"> <refnamediv> <refname>chunk_split</refname> <refpurpose>Rozdìlit øetìzec na mení èásti</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>chunk_split</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>chunklen</optional></parameter> </paramdef> <paramdef>string <parameter><optional>end</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Dá se pouít k rozdìlení øetìzce na mení èásti, co mùe být uiteèné napø. pøi uvádìní výstupu z <link linkend="function.base64-encode">base64_encode</link> do souladu se sémantikou RFC 2045. Kadých <parameter>chunklen</parameter> (defaultnì 76) znakù vloí øetìzec <parameter>end</parameter> (defaultnì "\r\n"). Vrátí nový øetìzec, pùvodní zùstává beze zmìny. <example> <title>Ukázka <function>Chunk_split</function></title> <programlisting role="php"> # naformátuje $data s pouitím RFC 2045 sémantiky $new_string = chunk_split (base64_encode($data)); </programlisting> </example> Tato funkce je výraznì rychlejí ne <function>ereg_replace</function>. <note> <para> Tato funkce byla pøidána v 3.0.6. </para> </note> </para> </refsect1> </refentry> <refentry id="function.convert-cyr-string"> <refnamediv> <refname>convert_cyr_string</refname> <refpurpose> Pøevést z jedné znakové sady Azbuky do jiné </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>convert_cyr_string</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>from</parameter></paramdef> <paramdef>string <parameter>to</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce pøevede daný øetìzec z jedné znakové sady azbuky do jiné. Argumenty <parameter>from</parameter> a <parameter>to</parameter> jsou jednotlivé znaky, které pøedstavují zdrojovou a cílovou znakovou sadu Azbuky. Podporované typy jsou: <itemizedlist> <listitem> <simpara> k - koi8-r </simpara> </listitem> <listitem> <simpara> w - windows-1251 </simpara> </listitem> <listitem> <simpara> i - iso8859-5 </simpara> </listitem> <listitem> <simpara> a - x-cp866 </simpara> </listitem> <listitem> <simpara> d - x-cp866 </simpara> </listitem> <listitem> <simpara> m - x-mac-cyrillic </simpara> </listitem> </itemizedlist> </para> </refsect1> </refentry> <refentry id="function.count-chars"> <refnamediv> <refname>count_chars</refname> <refpurpose>Vrátit informace o znacích pouitých v øetìzci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>count_chars</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef> <parameter> <optional>mode</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Spoèítá poèet výskytù vech byte hodnot (0..255) v <parameter>string</parameter> a vrátí je rùznými zpùsoby. Voltelný argument <parameter>Mode</parameter> má výchozí hodnotu 0. V závislosti na <parameter>mode</parameter> vrátí <function>count_chars</function> jednu z následujících moností: <itemizedlist> <listitem> <simpara> 0 - pole s klíèi tvoøenými byte hodnotami a hodnotami tvoøenými èetností kadého bytu. </simpara> </listitem> <listitem> <simpara> 1 - stejné jako 0, ale vrátí pouze byte hodnoty s èetností vyí ne nula. </simpara> </listitem> <listitem> <simpara> 2 - stejné jako 0, ale vrátí pouze byte hodnoty s èetností rovnou nule. </simpara> </listitem> <listitem> <simpara> 3 - vrátí øetìzec obsahující vechny pouité byte hodnoty. </simpara> </listitem> <listitem> <simpara> 4 - vrátí øetìzec obsahující vechny nepouité byte hodnoty. </simpara> </listitem> </itemizedlist> </para> <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </refsect1> </refentry> <refentry id="function.crc32"> <refnamediv> <refname>crc32</refname> <refpurpose>Spoèítat crc32 XXX polynomial øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>crc32</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Generuje 32bitový XXX polynomial kontrolního souètu pro <parameter>str</parameter>. Obvykle se pouívá ke kontrole integrity pøenáených dat. </para> <para> Viz také: <function>md5</function> </para> </refsect1> </refentry> <refentry id="function.crypt"> <refnamediv> <refname>crypt</refname> <refpurpose>Zaifrovat øetìzec algoritmem DES</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>crypt</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter><optional>salt</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>crypt</function> zaifruje øetìzec pomocí standardní Unixovské ifrovací metody <abbrev>DES</abbrev>. Argumenty jsou øetìzec k zaifrování a volitelný dvouznakový XXX salt, na kterém se ifrování zaloí. Více informací viz Unixovská man stránka vaí crypt funkce. </para> <simpara> Pokud není poskytnut XXX salt argument, PHP jej náhodnì vygeneruje. </simpara> <simpara> Nìkteré operaèní systémy podporují více typù ifrování. Nìkdy se standardní DES ifrování nahrazuje ifrovacím algoritmem zaloeným na MD5. Typ ifrování se zvolí podle XXX salt argumentu. Pøi instalaci PHP zjistí schopnosti funkce crypt a ??? bude pøijímat XXX salt pro jiné typy ifrování. Pøi absenci XXX salt PHP defaultnì automaticky vygeneruje standardní dvouznakový DES XXX salt, nicménì pokud je výchozím typem ifrování na daném systému MD5, vygeneruje náhodný XXX salt kompatibilní s MD5. PHP vytváøí konstantu CRYPT_SALT_LENGTH, která vám øekne, jestli se na vá systém hodí bìný dvouznakový XXX salt nebo delí dvanáctiznakový MD5 XXX salt. </simpara> <simpara> Pokud pouíváte poskytnutý XXX salt, mìli byste si být vìdomi toho, e se generuje jednou. Pokud tuto funkci voláte rekurzivnì, mùe to mít úèinek na XXX appearance, a, do urèité míry, bezpeènost. </simpara> <simpara> U standardního DES ifrování <function>crypt</function> pøidá XXX salt jako první dva znaky výstupu. </simpara> <simpara> Na systémech, kde funkce <function>crypt()</function> podporuje více typù ifrování se následující konstanty nastaví na 0 nebo 1 podle toho, jestli je daný typ dostupný: </simpara> <itemizedlist> <listitem> <simpara> CRYPT_STD_DES - Standardní DES ifrování s dvouznakovým XXX SALT </simpara> </listitem> <listitem> <simpara> CRYPT_EXT_DES - Rozíøené DES ifrování s devítiznakovým XXX SALT </simpara> </listitem> <listitem> <simpara> CRYPT_MD5 - MD5 ifrování s dvanáctiznakovým XXX SALT zaèínajícím $1$ </simpara> </listitem> <listitem> <simpara> CRYPT_BLOWFISH - Rozíøené DES ifrování s estnáctiznakovým XXX SALT zaèínajícím $2$ </simpara> </listitem> </itemizedlist> <simpara> Neexistuje ádná decrypt funkce, protoe <function>crypt</function> pouívá jednosmìrný algoritmus. </simpara> <simpara> Viz také: <function>md5</function>. </simpara> </refsect1> </refentry> <refentry id="function.echo"> <refnamediv> <refname>echo</refname> <refpurpose>Vytisknout jeden nebo více øetìzcù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef><function>echo</function></funcdef> <paramdef>string <parameter>arg1</parameter></paramdef> <paramdef>string <parameter><optional>argn</optional>...</parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> Outputs all parameters. </simpara> <para> <function>Echo</function> vlastnì není funkce (je to jazykový konstrukt), take u nìj nemusíte pouívat závorky. <example> <title>Ukázka <function>Echo</function></title> <programlisting role="php"> echo "Hello World"; echo "Toto zabírá nìkolik øádkù. Konce øádkù se vytisknou také"; echo "Toto zabírá\nnìkolik øádkù. Konce øádkù se\nvytisknou také."; </programlisting> </example> </para> <note> <para> Pokud chcete echo pøedat více argumentù, argumenty dokonce uzávorkovat nesmíte. </para> </note> <simpara> Viz také: <function>print</function>, <function>printf</function>, a <function>flush</function>. </simpara> </refsect1> </refentry> <refentry id="function.explode"> <refnamediv> <refname>explode</refname> <refpurpose>Rozdìlit øetìzec na jiném øetìzci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>explode</function></funcdef> <paramdef>string <parameter>separator</parameter></paramdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>limit</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Vrátí pole øetìzcù, z nich kadý je èástí argumentu <parameter>string</parameter> vzniklý jeho rozdìlením na hranicích tvoøených øetìzcem <parameter>delim</parameter>. Pokud je definován <parameter>limit</parameter>, vrácené pole bude obsahovat maximálnì <parameter>limit</parameter> prvkù, a poslední prvek bude obsahovat celý zbytek <parameter>string</parameter>. </para> <note> <para> Argument <parameter>limit</parameter> byl pøidán v PHP 4.0.1 </para> </note> <para> <example> <title>Ukázka <function>Explode</function></title> <programlisting role="php"> $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode (" ", $pizza); </programlisting> </example> </para> <note> <para> I kdy <function>implode</function> mùe z historických dùvodù pøijímat argumenty v obou moných poøadích, <function>explode</function> nemùe. Musíte se ujistit, e je argument <parameter>separator</parameter> pøed argumentem <parameter>string</parameter>. </para> </note> <para> Viz také <function>split</function> a <function>implode</function>. </para> </refsect1> </refentry> <refentry id="function.get-html-translation-table"> <refnamediv> <refname>get_html_translation_table</refname> <refpurpose> Vrátit pøekladovou tabulku pouívanou v <function>htmlspecialchars</function> a <function>htmlentities</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>get_html_translation_table</function> </funcdef> <paramdef>int <parameter>table</parameter></paramdef> <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>get_html_translation_table</function> vrátí pøekladovou tabulku, která se internì pouívá ve funkcích <function>htmlspecialchars</function> a <function>htmlentities</function>. Dvì nové konstanty (<parameter>HTML_ENTITIES</parameter>, <parameter>HTML_SPECIALCHARS</parameter>) vám umoòují urèit, kterou tabulku chcete. A stejnì jako u funkcí <function>htmlspecialchars</function> a <function>htmlentities</function> mùete pøípadnì urèit <parameter>quote_style</parameter> se kterým pracujete. Výchozí hodnota je ENT_COMPAT mód. Viz popis tìchto módù u <function>htmlspecialchars</function>. <example> <title>Ukázka Translation Table</title> <programlisting role="php"> $trans = get_html_translation_table (HTML_ENTITIES); $str = "Hallo & <Frau> & Krämer"; $encoded = strtr ($str, $trans); </programlisting> </example> Promìnná <literal>$encoded</literal> teï obsahuje: "Hallo &<sgmltag>amp</sgmltag>; &<sgmltag>lt</sgmltag>;Frau&<sgmltag>gt</sgmltag>; &<sgmltag>amp</sgmltag>; Kr&<sgmltag>auml</sgmltag>;mer". </para> <para> Skvìlé je, e pomocí <function>array_flip</function> mùete zmìnit smìr pøekladu. <informalexample> <programlisting role="php"> $trans = array_flip ($trans); $original = strtr ($str, $trans); </programlisting> </informalexample> Obsahem <literal>$original</literal> je: "Hallo & <Frau> & Krämer". <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </para> <para> Viz také: <function>htmlspecialchars</function>, <function>htmlentities</function>, <function>strtr</function>, a <function>array_flip</function>. </para> </refsect1> </refentry> <refentry id="function.get-meta-tags"> <refnamediv> <refname>get_meta_tags</refname> <refpurpose> Získat hodnoty content atributù vech meta tagù v souboru a vrátit pole </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_meta_tags</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> <paramdef>int <parameter><optional>use_include_path</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Otevøe <parameter>filename</parameter>, pøeète ho po øádcích, a vyhledá <meta> tagy ve tvaru <example> <title>Ukázka na Meta Tagy</title> <programlisting role="html"> <meta name="author" content="name"> <meta name="tags" content="php3 documentation"> </head> <!-- tady ètení skonèí --> </programlisting> </example> (vìnujte pozornost koncùm øádkù - PHP pouívá ke ètení vstupu nativní funkci, take Macovský soubor na Unixu nebude fungovat). </para> <para> Hodnota atributu name se ve vráceném poli stává klíèem, hodnota atributu content hodnotou tohoto pole, takzè ho mùete snadno projít nebo získat jednotlivé hodnoty pomocí snandardních funkcí pro práci s poli. Zvlátní znaky v hodnotì atributu name jsou nahrazeny znakem '_', zbytek se pøevede na malá písmena. </para> <para> Pokud je <parameter>use_include_path</parameter> rovno 1, PHP se pokusí otevøít soubor ve standardní include cestì. </para> </refsect1> </refentry> <refentry id="function.hebrev"> <refnamediv> <refname>hebrev</refname> <refpurpose> Pøevést logický Hebrejský text na vizuální text </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>hebrev</function></funcdef> <paramdef>string <parameter>hebrew_text</parameter></paramdef> <paramdef>int <parameter><optional>max_chars_per_line</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Volitelný argument <parameter>max_chars_per_line</parameter> indikuje maximální poèet znakù na øádek výstupu. Funkce se snaí nerozdìlovat slova. </para> <para> Viz také <function>hebrevc</function> </para> </refsect1> </refentry> <refentry id="function.hebrevc"> <refnamediv> <refname>hebrevc</refname> <refpurpose> Pøevést logický Hebrejský text na vizuální text s konverzí koncù øádkù </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>hebrevc</function></funcdef> <paramdef>string <parameter>hebrew_text</parameter></paramdef> <paramdef>int <parameter><optional>max_chars_per_line</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce se podobá <function>hebrev</function> s tím rozdílem, e pøevádí konce øádkù (\n) na "<br>\n". Volitelný argument <parameter>max_chars_per_line</parameter> indikuje maximální poèet znakù na øádek výstupu. Funkce se snaí nerozdìlovat slova. </para> <para> Viz také <function>hebrev</function> </para> </refsect1> </refentry> <refentry id="function.htmlentities"> <refnamediv> <refname>htmlentities</refname> <refpurpose>Pøevést vechny pouitelné znaky na HTML entity</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>htmlentities</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je ve vem shodná s <function>htmlspecialchars</function> kromì toho, e na HTML entity se pøevedou vechny znaky, které mají odpovídající entity. Stejnì jako <function>htmlspecialchars</function> pøijímá volitelný druhý argument, který indikuje, co se má stát s jednoduchými a dvojitými uvozovkami. <constant>ENT_COMPAT</constant> (výchozí) pøevede pouze dvojité uvozovky, <constant>ENT_QUOTES</constant> pøevede dvojité i jednoduché uvozovky, a <constant>ENT_NOQUOTES</constant> ponechá jednoduché i dvojité uvozovky bez konverze. </para> <para> V souèasnosti se pouívá znaková sada ISO-8859-1. Volitelný druhý argument byl pøidán v PHP 3.0.17 a PHP 4.0.3. </para> <para> Viz také <function>htmlspecialchars</function> a <function>nl2br</function>. </para> </refsect1> </refentry> <refentry id="function.htmlspecialchars"> <refnamediv> <refname>htmlspecialchars</refname> <refpurpose>Pøevést zvlátní znaky na HTML entity</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>htmlspecialchars</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Nìkteré znaky mají v HTML zvlátní význam, a pokud si mají zachovat bìný význam, mìly by být reprezentovány HTML entitami. Tato funkce vrátí øetìzec, ve kterém dolo k nìkterým z tìchto konverzí; provádìjí se ty pøeklady, které jsou v kadodenním programování pro web nejuiteènìjí. Pokud poadujete pøeklad vech znakových entit HTML, pouijte <function>htmlentities</function>. </para> <simpara> Tato funkce je uiteèná, pokud se chcete chránit pøed pøípadným výskytem HTML v textu dodaném uivateli, napøíklad u aplikací typu kniha hostù nebo diskusní skupina. Volitelný druhý argument, quote_style, urèuje, co se má stát s jednoduchými a dvojitými uvozovkami. Defaultní mód, ENT_COMPAT, je zpìtnì kompatibilní mód, konvertuje pouze dvojité uvozovky a jednoduché uvozovky ponechává nepøeloené. Pokud zadáte ENT_QUOTES, pøeloí se jednoduché i dvojité uvozovky, a pokud zadáte ENT_NOQUOTES, oba druhy zùstanou bez pøekladu. </simpara> <para> Dochází k tìmto pøekladùm: <itemizedlist> <listitem> <simpara> '&' (ampersand) se stává '&amp;' </simpara> </listitem> <listitem> <simpara> '"' (dvojitá uvozovka) se stává '&quot;' when ENT_NOQUOTES is not set. </simpara> </listitem> <listitem> <simpara> ''' (jednoduchá uvozovka) se stává '&#039;' only when ENT_QUOTES is set. </simpara> </listitem> <listitem> <simpara> '<' (mení ne) se stává '&lt;' </simpara> </listitem> <listitem> <simpara> '>' (vìtí ne) se stává '&gt;' </simpara> </listitem> </itemizedlist> <example> <title>Ukázka <function>htmlspecialchars</function></title> <programlisting role="php"> $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); </programlisting> </example> </para> <para> Poznámka: tato funkce provádí pouze výe uvedené pøeklady. Kompletní pøeklad entit viz <function>htmlentities</function>. Volitelný druhý argument byl pøidán v PHP 3.0.17 a PHP 4.0.3. </para> <para> Viz také <function>htmlentities</function> a <function>nl2br</function>. </para> </refsect1> </refentry> <refentry id="function.implode"> <refnamediv> <refname>implode</refname> <refpurpose>Spojit prvky pole pomocí øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>implode</function></funcdef> <paramdef>string <parameter>glue</parameter></paramdef> <paramdef>array <parameter>pieces</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec obsahující øetìzcovou reprezentaci vech prvkù pole v pùvodním poøadí s øetìzcem <parameter>glue</parameter> mezi kadými dvìma prvky. <example> <title>Ukázka <function>Implode</function></title> <programlisting role="php"> $colon_separated = implode (":", $array); </programlisting> </example> </para> <note> <para> <function>implode</function> mùe z historických dùvodù pøijímat argumenty v obou moných poøadích. Kvùli konzistenci s <function>explode</function> je ale asi ménì matoucí pouívat dokumentované poøadí argumentù. </para> </note> <simpara> Viz také <function>explode</function>, <function>join</function>, a <function>split</function>. </simpara> </refsect1> </refentry> <refentry id="function.join"> <refnamediv> <refname>join</refname> <refpurpose>Spojit prvky pole pomocí øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>join</function></funcdef> <paramdef>string <parameter>glue</parameter></paramdef> <paramdef>array <parameter>pieces</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>join</function> je alias k <function>implode</function>, a je ve vech ohledech stejná. </simpara> <simpara> Viz také <function>explode</function>, <function>implode</function>, a <function>split</function>. </simpara> </refsect1> </refentry> <refentry id="function.levenshtein"> <refnamediv> <refname>levenshtein</refname> <refpurpose> Spoèítat XXX Levenshteinovu vzdálenost mezi dvìma øetìzci </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>levenshtein</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> <funcprototype> <funcdef>int <function>levenshtein</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>int <parameter>cost_ins</parameter></paramdef> <paramdef>int <parameter>cost_rep</parameter></paramdef> <paramdef>int <parameter>cost_del</parameter></paramdef> </funcprototype> <funcprototype> <funcdef>int <function>levenshtein</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>function <parameter>cost</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí ??? Levenshtein-Distance mezi pøedanými øetìzci nebo -1, pokud délka jednoho z pøedaných øetìzcù pøesáhne omezení 255 znakù (255 by mìlo být pro bìná porovnání víc ne dost, a nikdo se zdravým rozumem nebude v PHP dìlat genetickou analýzu). </para> <para> Levenshteinova vzdálenost se definuje jako minimální poèet znaku, které musíte nahradit, vloit nebo smazat, abyste zmìnili <parameter>str1</parameter> na <parameter>str2</parameter>. Sloitost tohoto algoritmu je <literal>O(m*n)</literal>, kde <literal>n</literal> a <literal>m</literal> jsou délky <parameter>str1</parameter> a <parameter>str2</parameter> (celkem sluné v porovnání se <function>similar_text</function>, který je O(max(n,m)**3), ale i tak drahé). </para> <para> Ve své nejjednoduí podobì tato funkce pouze vezme dva øetìzce jako argumenty a spoèítá poèet vloení, nahrazení a smazání nutných k transformaci <parameter>str1</parameter> na <parameter>str2</parameter>. </para> <para> Druhá varianta pøijme tøi dalí argumenty, které definují náklady na operace vloení, nahrazeni a smazání. Tato varianta je veobecnìjí a pøizpùsobivìjí ne varianta první, ale ne tak výkonná. </para> <para> Tøetí varianta (zatím neimplementovaná) bude nejveobecnìjí a nejpøizpùsobivìjí, ale také nejpomalejí alternativou. Bude volat uivatelskou funkci, která urèí náklady na vechny moné operace. </para> <para> Tato uivatelská funkce se bude volat s následujícími argumenty: <itemizedlist> <listitem> <simpara> operatce, která se má provést: 'I', 'R' or 'D' </simpara> </listitem> <listitem> <simpara> pùvodní znak v øetìzci 1 </simpara> </listitem> <listitem> <simpara> pùvodní znak v øetìzci 2 </simpara> </listitem> <listitem> <simpara> pozice v øetìzci 1 </simpara> </listitem> <listitem> <simpara> pozice v øetìzci 2 </simpara> </listitem> <listitem> <simpara> znaky zbývající v øetìzci 1 </simpara> </listitem> <listitem> <simpara> znaky zbývající v øetìzci 2 </simpara> </listitem> </itemizedlist> Tato uivatelská funkce musí vrátit kladné celé èíslo vyèíslující náklady na tuto konkrétní operaci, ale mùe se rozhodnout pouít pouze nìkteré z pøijatých argumentù. </para> <para> Tento pøístup nabízí monost zohlednit dùleitost urèitých symbolù (znakù) a/nebo rozdíly mezi nimi, èi dokonce kontext, ve kterém se vyskytují pøi urèování nákladù na vloení, zmìnu nebo smazání, ale za cenu ztráty vech optimalizací vyuití CPU registru a XXX cache misses, které byly zapracovány do pøedchozích dvou variant. </para> <para> Viz také <function>soundex</function>, <function>similar_text</function> a <function>metaphone</function>. </para> </refsect1> </refentry> <refentry id="function.ltrim"> <refnamediv> <refname>ltrim</refname> <refpurpose>Odstranit netisknutelné znaky ze zaèátku øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ltrim</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce oøízne netisknutelné znaky ze zaèátku øetìzce a vrátí oøíznutý øetìzec. Netisknutelné znaky, které se v souèasnosti odstraòují, jsou: "\n", "\r", "\t", "\v", "\0", a prostá mezera. </para> <para> Viz také <function>chop</function>, <function>rtrim</function>, a <function>trim</function>. </para> </refsect1> </refentry> <refentry id="function.md5"> <refnamediv> <refname>md5</refname> <refpurpose>Spoèítat MD5 XXX hash øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>md5</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Spoèítá MD5 XXX hash argumentu <parameter>str</parameter> pomocí <ulink url="&url.rfc;rfc1321.html">MD5 Message-Digest Algoritmu spoleènosti RSA Data Security, Inc.</ulink>. </para> <para> Viz také: <function>crc32</function> </para> </refsect1> </refentry> <refentry id="function.metaphone"> <refnamediv> <refname>Metaphone</refname> <refpurpose>Spoèítat metaphone klíè øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>metaphone</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Spoèítá metaphone klíè argumentu <parameter>str</parameter>. </para> <para> <function>etaphone</function>, podobnì jako <function>soundex</function>, vytvoøí stejný klíè pro podobnì znìjící slova. Je pøesnìjí ne <function>soundex</function>, protoe zná základní pravidla anglické výslovnosti. Metaphone klíèe mají promìnlivou délku. </para> <para> Metaphone vyvinul Lawrence Philips <lphilips@verity.com>. Je popsáno v ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995]. <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </para> </refsect1> </refentry> <refentry id="function.nl2br"> <refnamediv> <refname>nl2br</refname> <refpurpose>Pøevede konce øádkù na HTML XXX konce øádkù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>nl2br</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí <parameter>string</parameter>, ve kterém je pøed kadý konec øádku vloen tag '<BR>'. </para> <para> Viz také <function>htmlspecialchars</function>, <function>htmlentities</function> a <function>wordwrap</function>. </para> </refsect1> </refentry> <refentry id="function.ord"> <refnamediv> <refname>Ord</refname> <refpurpose>Vrátit ASCII hodnotu znaku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ord</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí ASCII hodnotu prvního znaku v <parameter>string</parameter>. Tato funkce doplòuje <function>chr</function>. <example> <title>Ukázka <function>Ord</function></title> <programlisting role="php"> if (ord ($str) == 10) { echo "Prvním znakem \$str je line feed.\n"; } </programlisting> </example> </para> <simpara> Viz také <function>chr</function>. </simpara> </refsect1> </refentry> <refentry id="function.parse-str"> <refnamediv> <refname>parse_str</refname> <refpurpose>Rozloit øetìzec do promìnných</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>parse_str</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>array <parameter><optional>arr</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Rozloí øetìzec, jako kdyby to byl query string pøedaný v URL a definuje pøísluné promìnné v souèasném prostoru. Pokud je pøedán druhý argument <parameter>arr</parameter>, promìnné se místo toho uloí do této promìnné jako pole. </para> <para> <example> <title>Using <function>parse_str</function></title> <programlisting role="php"> $str = "first=value&second[]=this+works&second[]=another"; parse_str($str); echo $first; /* vytiskne "value" */ echo $second[0]; /* vytiskne "this works" */ echo $second[1]; /* vytiskne "another" */ </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.print"> <refnamediv> <refname>print</refname> <refpurpose>Vytisknout øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef><function>print</function></funcdef> <paramdef>string <parameter>arg</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vytiskne <parameter>arg</parameter>. </simpara> <simpara> Viz také: <function>echo</function>, <function>printf</function>, a <function>flush</function>. </simpara> </refsect1> </refentry> <refentry id="function.printf"> <refnamediv> <refname>printf</refname> <refpurpose>Vytisknout formátovaný øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>printf</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed <parameter><optional>args</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> <simpara> Vytvoøí výtup podle argumentu <parameter>format</parameter>, který je popsán v dokumentaci <function>sprintf</function>. </simpara> <simpara> Viz také: <function>print</function>, <function>sprintf</function>, <function>sscanf</function>, <function>fscanf</function>, a <function>flush</function>. </simpara> </refsect1> </refentry> <refentry id="function.quoted-printable-decode"> <refnamediv> <refname>quoted_printable_decode</refname> <refpurpose> Pøevést quoted-printable øetìzec na osmibitový øetìzec </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>quoted_printable_decode</function> </funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Tato funkce vrátí osmibitový binární øetìzec odpovídající dekédovanému quoted printable øetìzci. Tato funkce je podobná <function>imap_qprint</function>, s tou výjimkou, e tato funkce nevyaduje IMAP modul. </simpara> </refsect1> </refentry> <refentry id="function.quotemeta"> <refnamediv> <refname>quotemeta</refname> <refpurpose>Opatøit lomítky metaznaky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>quotemeta</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí verzi <parameter>str</parameter> se zpìtným lomítkem pøed vemi výskyty následujících znakù: <screen>. \\ + * ? [ ^ ] ( $ )</screen> </para> <simpara> Viz také <function>addslashes</function>, <function>htmlentities</function>, <function>htmlspecialchars</function>, <function>nl2br</function>, a <function>stripslashes</function>. </simpara> </refsect1> </refentry> <refentry id="function.rtrim"> <refnamediv> <refname>rtrim</refname> <refpurpose>Odstranit netisknutelné znaky z konce øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcdef>string <function>rtrim</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcsynopsis> <para> Vrátí pøedaný øetìzec bez netisknutelných znakù (vè. koncù øádku) na konci. Toto je alias k <function>chop</function>. <example> <title>Ukázka <function>rtrim</function></title> <programlisting role="php"> $trimmed = rtrim ($line); </programlisting> </example> </para> <para> Viz také <function>trim</function>, <function>ltrim</function>, a <function>rtrim</function>. </para> </refsect1> </refentry> <refentry id="function.sscanf"> <refnamediv> <refname>sscanf</refname> <refpurpose>Parses input from a string according to a format</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>sscanf</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>string <parameter><optional>var1</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> <para> The function <function>sscanf</function> is the input analog of <function>printf</function>. <function>Sscanf</function> reads from the string <parameter>str</parameter> and interprets it according to the specified <parameter>format</parameter>. If only two parameters were passed to this function, the values parsed will be returned as an array. <example> <title>Ukázka <function>Sscanf</function> Example</title> <programlisting role="php"> // getting the serial number $serial = sscanf("SN/2350001","SN/%d"); // and the date of manufacturing $mandate = "January 01 2000"; list($month, $day, $year) = sscanf($mandate,"%s %d %d"); echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n"; </programlisting> </example> If optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference. <example> <title>Ukázka <function>Sscanf</function> - using optional parameters</title> <programlisting role="php"> // get author info and generate DocBook entry $auth = "24\tLewis Carroll"; $n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); echo "<author id='$id'> <firstname>$first</firstname> <surname>$last</surname> </author>\n"; </programlisting> </example> </para> <para> Viz také: <function>fscanf</function>, <function>printf</function>, and <function>sprintf</function>. </para> </refsect1> </refentry> <refentry id="function.setlocale"> <refnamediv> <refname>setlocale</refname> <refpurpose>Set locale information</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>setlocale</function></funcdef> <paramdef>string <parameter>category</parameter></paramdef> <paramdef>string <parameter>locale</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <parameter>Category</parameter> is a string specifying the category of the functions affected by the locale setting: <itemizedlist> <listitem> <simpara> LC_ALL for all of the below </simpara> </listitem> <listitem> <simpara> LC_COLLATE for string comparison - not currently implemented in PHP </simpara> </listitem> <listitem> <simpara> LC_CTYPE for character classification and conversion, for example <function>strtoupper</function> </simpara> </listitem> <listitem> <simpara> LC_MONETARY for localeconv() - not currently implemented in PHP </simpara> </listitem> <listitem> <simpara> LC_NUMERIC for decimal separator </simpara> </listitem> <listitem> <simpara> LC_TIME for date and time formatting with <function>strftime</function> </simpara> </listitem> </itemizedlist> </para> <para> If <parameter>locale</parameter> is the empty string <literal>""</literal>, the locale names will be set from the values of environment variables with the same names as the above categories, or from "LANG". </para> <para> If locale is zero or <literal>"0"</literal>, the locale setting is not affected, only the current setting is returned. </para> <para> Setlocale returns the new current locale, or false if the locale functionality is not implemented in the plattform, the specified locale does not exist or the category name is invalid. An invalid category name also causes a warning message. </para> </refsect1> </refentry> <refentry id="function.similar-text"> <refnamediv> <refname>similar_text</refname> <refpurpose> Calculate the similarity between two strings </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>similar_text</function></funcdef> <paramdef>string <parameter>first</parameter></paramdef> <paramdef>string <parameter>second</parameter></paramdef> <paramdef>double <parameter><optional>percent</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> This calculates the similarity between two strings as described in Oliver [1993]. Note that this implementation does not use a stack as in Oliver's pseudo code, but recursive calls which may or may not speed up the whole process. Note also that the complexity of this algorithm is O(N**3) where N is the length of the longest string. </para> <para> By passing a reference as third argument, <function>similar_text</function> will calculate the similarity in percent for you. It returns the number of matching chars in both strings. </para> </refsect1> </refentry> <refentry id="function.soundex"> <refnamediv> <refname>soundex</refname> <refpurpose>Calculate the soundex key of a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>soundex</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Calculates the soundex key of <parameter>str</parameter>. </para> <para> Soundex keys have the property that words pronounced similarly produce the same soundex key, and can thus be used to simplify searches in databases where you know the pronunciation but not the spelling. This soundex function returns a string 4 characters long, starting with a letter. </para> <para> This particular soundex function is one described by Donald Knuth in "The Art Of Computer Programming, vol. 3: Sorting And Searching", Addison-Wesley (1973), pp. 391-392. </para> <para> <example> <title>Soundex Examples</title> <programlisting role="php"> soundex ("Euler") == soundex ("Ellery") == 'E460'; soundex ("Gauss") == soundex ("Ghosh") == 'G200'; soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; soundex ("Knuth") == soundex ("Kant") == 'K530'; soundex ("Lloyd") == soundex ("Ladd") == 'L300'; soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.sprintf"> <refnamediv> <refname>sprintf</refname> <refpurpose>Return a formatted string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>sprintf</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed <parameter><optional>args</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> <simpara> Returns a string produced according to the formatting string <parameter>format</parameter>. </simpara> <simpara> The format string is composed of zero or more directives: ordinary characters (excluding <literal>%</literal>) that are copied directly to the result, and <emphasis>conversion specifications</emphasis>, each of which results in fetching its own parameter. This applies to both <function>sprintf</function> and <function>printf</function>. </simpara> <para> Each conversion specification consists of a percent sign (<literal>%</literal>), followed by one or more of these elements, in order: <orderedlist> <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 <literal>0</literal> (zero character). The default is to pad with spaces. An alternate padding character can be specified by prefixing it with a single quote (<literal>'</literal>). See the examples below. </simpara> </listitem> <listitem> <simpara> An optional <emphasis>alignment specifier</emphasis> that says if the result should be left-justified or right-justified. The default is right-justified; a <literal>-</literal> character here will make it left-justified. </simpara> </listitem> <listitem> <simpara> An optional number, a <emphasis>width specifier</emphasis> that says how many characters (minimum) this conversion should result in. </simpara> </listitem> <listitem> <simpara> An optional <emphasis>precision specifier</emphasis> that says how many decimal digits should be displayed for floating-point numbers. This option has no effect for other types than double. (Another function useful for formatting numbers is <function>number_format</function>.) </simpara> </listitem> <listitem> <para> A <emphasis>type specifier</emphasis> that says what type the argument data should be treated as. Possible types: <simplelist> <member> <literal>%</literal> - a literal percent character. No argument is required. </member> <member> <literal>b</literal> - the argument is treated as an integer, and presented as a binary number. </member> <member> <literal>c</literal> - the argument is treated as an integer, and presented as the character with that ASCII value. </member> <member> <literal>d</literal> - the argument is treated as an integer, and presented as a decimal number. </member> <member> <literal>f</literal> - the argument is treated as a double, and presented as a floating-point number. </member> <member> <literal>o</literal> - the argument is treated as an integer, and presented as an octal number. </member> <member> <literal>s</literal> - the argument is treated as and presented as a string. </member> <member> <literal>x</literal> - the argument is treated as an integer and presented as a hexadecimal number (with lowercase letters). </member> <member> <literal>X</literal> - the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters). </member> </simplelist> </para> </listitem> </orderedlist> </para> <simpara> Viz také: <function>printf</function>, <function>sscanf</function>, <function>fscanf</function>, and <function>number_format</function>. </simpara> </refsect1> <refsect1> <title>Examples</title> <para> <example> <title>Ukázka <function>Sprintf</function>: zero-padded integers</title> <programlisting role="php"> $isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day); </programlisting> </example> <example> <title>Ukázka <function>Sprintf</function>: formatting currency</title> <programlisting role="php"> $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output "123.1"; $formatted = sprintf ("%01.2f", $money); // echo $formatted will output "123.10" </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.strncasecmp"> <refnamediv> <refname>strncasecmp</refname> <refpurpose> Binary safe case-insensitive string comparison of the first n characters </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strncasecmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>int <parameter>len</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function is similar to <function>strcasecmp</function>, with the difference that you can specify the (upper limit of the) number of characters (<parameter>len</parameter>) from each string to be used in the comparison. If any of the strings is shorter than <parameter>len</parameter>, then the length of that string will be used for the comparison. </para> <simpara> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>strcmp</function>, <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strcasecmp"> <refnamediv> <refname>strcasecmp</refname> <refpurpose> Binary safe case-insensitive string comparison </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strcasecmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. <example> <title>Ukázka <function>strcasecmp</function></title> <programlisting role="php"> $var1 = "Hello"; $var2 = "hello"; if (!strcasecmp ($var1, $var2)) { echo '$var1 is equal to $var2 in a case-insensitive string comparison'; } </programlisting> </example> </para> <simpara> Viz také <function>ereg</function>, <function>strcmp</function>, <function>substr</function>, <function>stristr</function>, <function>strncasecmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strchr"> <refnamediv> <refname>strchr</refname> <refpurpose> Find the first occurrence of a character </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strchr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function is an alias for <function>strstr</function>, and is identical in every way. </para> </refsect1> </refentry> <refentry id="function.strcmp"> <refnamediv> <refname>strcmp</refname> <refpurpose>Binary safe string comparison</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strcmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Note that this comparison is case sensitive. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strncasecmp</function>, <function>strncmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strcspn"> <refnamediv> <refname>strcspn</refname> <refpurpose> Find length of initial segment not matching mask </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strcspn</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns the length of the initial segment of <parameter>str1</parameter> which does <emphasis>not</emphasis> contain any of the characters in <parameter>str2</parameter>. </simpara> <simpara> Viz také <function>strspn</function>. </simpara> </refsect1> </refentry> <refentry id="function.strip-tags"> <refnamediv> <refname>strip_tags</refname> <refpurpose>Strip HTML and PHP tags from a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strip_tags</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter><optional>allowable_tags</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> This function tries to strip all HTML and PHP tags from the given string. It errors on the side of caution in case of incomplete or bogus tags. It uses the same tag stripping state machine as the <function>fgetss</function> function. </para> <para> You can use the optional second parameter to specify tags which should not be stripped. <note> <para> <parameter>Allowable_tags</parameter> was added in PHP 3.0.13, PHP4B3. </para> </note> </para> </refsect1> </refentry> <refentry id="function.stripcslashes"> <refnamediv> <refname>stripcslashes</refname> <refpurpose> Un-quote string quoted with <function>addcslashes</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>stripcslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns a string with backslashes stripped off. Recognizes C-like <literal>\n</literal>, <literal>\r</literal> ..., octal and hexadecimal representation. <note> <simpara> Added in PHP4b3-dev. </simpara> </note> </para> <simpara> Viz také <function>addcslashes</function>. </simpara> </refsect1> </refentry> <refentry id="function.stripslashes"> <refnamediv> <refname>stripslashes</refname> <refpurpose> Un-quote string quoted with <function>addslashes</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>stripslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns a string with backslashes stripped off. (<literal>\'</literal> becomes <literal>'</literal> and so on.) Double backslashes are made into a single backslash. </para> <simpara> Viz také <function>addslashes</function>. </simpara> </refsect1> </refentry> <refentry id="function.stristr"> <refnamediv> <refname>stristr</refname> <refpurpose> Case-insensitive <function>strstr</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>stristr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns all of <parameter>haystack</parameter> from the first occurrence of <parameter>needle</parameter> to the end. <parameter>needle</parameter> and <parameter>haystack</parameter> are examined in a case-insensitive manner. </para> <para> If <parameter>needle</parameter> is not found, returns false. </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> Viz také <function>strchr</function>, <function>strrchr</function>, <function>substr</function>, and <function>ereg</function>. </para> </refsect1> </refentry> <refentry id="function.strlen"> <refnamediv> <refname>strlen</refname> <refpurpose>Get string length</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strlen</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns the length of <parameter>string</parameter>. </para> </refsect1> </refentry> <refentry id="function.strnatcmp"> <refnamediv> <refname>strnatcmp</refname> <refpurpose> String comparisons using a "natural order" algorithm </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strnatcmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would, this is described as a "natural ordering". An example of the difference between this algorithm and the regular computer string sorting algorithms (used in <function>strcmp</function>) can be seen below: <informalexample> <programlisting> $arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); echo "Standard string comparison\n"; usort($arr1,"strcmp"); print_r($arr1); echo "\nNatural order string comparison\n"; usort($arr2,"strnatcmp"); print_r($arr2); </programlisting> </informalexample> The code above will generate the following output: <informalexample> <programlisting> Standard string comparison Array ( [0] => img1.png [1] => img10.png [2] => img12.png [3] => img2.png ) Natural order string comparison Array ( [0] => img1.png [1] => img2.png [2] => img10.png [3] => img12.png ) </programlisting> </informalexample> For more infomation see: Martin Pool's <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> page. </para> <simpara> Similar to other string comparison functions, this one returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Note that this comparison is case sensitive. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, <function>strncmp</function>, <function>strncasecmp</function>, <function>strnatcasecmp</function>, <function>strstr</function>, <function>natsort</function> and <function>natcasesort</function>. </simpara> </refsect1> </refentry> <refentry id="function.strnatcasecmp"> <refnamediv> <refname>strnatcasecmp</refname> <refpurpose> Case insensitive string comparisons using a "natural order" algorithm </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strnatcasecmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would. The behavior of this function is similar to <function>strnatcmp</function>, except that the comparison is not case sensitive. For more infomation see: Martin Pool's <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> page. </para> <simpara> Similar to other string comparison functions, this one returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, <function>strncmp</function>, <function>strncasecmp</function>, <function>strnatcmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strncmp"> <refnamediv> <refname>strncmp</refname> <refpurpose> Binary safe string comparison of the first n characters </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strncmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>int <parameter>len</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function is similar to <function>strcmp</function>, with the difference that you can specify the (upper limit of the) number of characters (<parameter>len</parameter>) from each string to be used in the comparison. If any of the strings is shorter than <parameter>len</parameter>, then the length of that string will be used for the comparison. </para> <simpara> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Note that this comparison is case sensitive. </simpara> <simpara> Viz také <function>ereg</function>, <function>strncasecmp</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.str-pad"> <refnamediv> <refname>str_pad</refname> <refpurpose>Pad a string to a certain length with another string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>str_pad</function></funcdef> <paramdef>string <parameter>input</parameter></paramdef> <paramdef>int <parameter>pad_length</parameter></paramdef> <paramdef>string <parameter><optional>pad_string</optional></parameter></paramdef> <paramdef>int <parameter><optional>pad_type</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> This functions pads the <parameter>input</parameter> string on the left, the right, or both sides to the specifed padding length. If the optional argument <parameter>pad_string</parameter> is not supplied, the <parameter>input</parameter> is padded with spaces, otherwise it is padded with characters from <parameter>pad_string</parameter> up to the limit. </para> <para> Optional argument <parameter>pad_type</parameter> can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If <parameter>pad_type</parameter> is not specified it is assumed to be STR_PAD_RIGHT. </para> <para> If the value of <parameter>pad_length</parameter> is negative or less than the length of the input string, no padding takes place. </para> <para> <example> <title>Ukázka <function>str_pad</function></title> <programlisting role="php"> $input = "Alien"; print str_pad($input, 10); // produces "Alien " print str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien" print str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___" </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.strpos"> <refnamediv> <refname>strpos</refname> <refpurpose> Find position of first occurrence of a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> <paramdef>int <parameter><optional>offset</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Returns the numeric position of the first occurrence of <parameter>needle</parameter> in the <parameter>haystack</parameter> string. Unlike the <function>strrpos</function>, this function can take a full string as the <parameter>needle</parameter> parameter and the entire string will be used. </para> <para> If <parameter>needle</parameter> is not found, returns false. <note> <para> It is easy to mistake the return values for "character found at position 0" and "character not found". Here's how to detect the difference: <informalexample> <programlisting role="php"> // in PHP 4.0b3 and newer: $pos = strpos ($mystring, "b"); if ($pos === false) { // note: three equal signs // not found... } // in versions older than 4.0b3: $pos = strpos ($mystring, "b"); if (is_string ($pos) && !$pos) { // not found... } </programlisting> </informalexample> </para> </note> </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> The optional <parameter>offset</parameter> parameter allows you to specify which character in <parameter>haystack</parameter> to start searching. The position returned is still relative to the the beginning of <parameter>haystack</parameter>. </para> <para> Viz také <function>strrpos</function>, <function>strrchr</function>, <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </para> </refsect1> </refentry> <refentry id="function.strrchr"> <refnamediv> <refname>strrchr</refname> <refpurpose> Find the last occurrence of a character in a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strrchr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function returns the portion of <parameter>haystack</parameter> which starts at the last occurrence of <parameter>needle</parameter> and goes until the end of <parameter>haystack</parameter>. </para> <para> Returns false if <parameter>needle</parameter> is not found. </para> <para> If <parameter>needle</parameter> contains more than one character, the first is used. </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. <example> <title>Ukázka <function>Strrchr</function></title> <programlisting role="php"> // get last directory in $PATH $dir = substr (strrchr ($PATH, ":"), 1); // get everything after last newline $text = "Line 1\nLine 2\nLine 3"; $last = substr (strrchr ($text, 10), 1 ); </programlisting> </example> </para> <para> Viz také <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </para> </refsect1> </refentry> <refentry id="function.str-repeat"> <refnamediv> <refname>str_repeat</refname> <refpurpose>Repeat a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>str_repeat</function></funcdef> <paramdef>string <parameter>input</parameter></paramdef> <paramdef>int <parameter>multiplier</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns <parameter>input_str</parameter> repeated <parameter>multiplier</parameter> times. <parameter>multiplier</parameter> has to be greater than 0. </para> <example> <title>Ukázka <function>Str_repeat</function></title> <programlisting role="php"> echo str_repeat ("-=", 10); </programlisting> </example> <para> This will output "-=-=-=-=-=-=-=-=-=-=". </para> <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </refsect1> </refentry> <refentry id="function.strrev"> <refnamediv> <refname>strrev</refname> <refpurpose>Reverse a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strrev</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns <parameter>string</parameter>, reversed. </para> </refsect1> </refentry> <refentry id="function.strrpos"> <refnamediv> <refname>strrpos</refname> <refpurpose> Find position of last occurrence of a char in a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strrpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>char <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns the numeric position of the last occurrence of <parameter>needle</parameter> in the <parameter>haystack</parameter> string. Note that the needle in this case can only be a single character. If a string is passed as the needle, then only the first character of that string will be used. </para> <para> If <parameter>needle</parameter> is not found, returns false. <note> <para> It is easy to mistake the return values for "character found at position 0" and "character not found". Here's how to detect the difference: <informalexample> <programlisting role="php"> // in PHP 4.0b3 and newer: $pos = strrpos ($mystring, "b"); if ($pos === false) { // note: three equal signs // not found... } // in versions older than 4.0b3: $pos = strrpos ($mystring, "b"); if (is_string ($pos) && !$pos) { // not found... } </programlisting> </informalexample> </para> </note> </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> Viz také <function>strpos</function>, <function>strrchr</function>, <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </para> </refsect1> </refentry> <refentry id="function.strspn"> <refnamediv> <refname>strspn</refname> <refpurpose> Find length of initial segment matching mask </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strspn</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns the length of the initial segment of <parameter>str1</parameter> which consists entirely of characters in <parameter>str2</parameter>. </simpara> <para> <informalexample> <programlisting role="php"> strspn ("42 is the answer, what is the question ...", "1234567890"); </programlisting> <para> will return 2 as result. </para> </informalexample> </para> <simpara> Viz také <function>strcspn</function>. </simpara> </refsect1> </refentry> <refentry id="function.strstr"> <refnamediv> <refname>strstr</refname> <refpurpose>Find first occurrence of a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strstr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns all of <parameter>haystack</parameter> from the first occurrence of <parameter>needle</parameter> to the end. </para> <para> If <parameter>needle</parameter> is not found, returns false. </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> <note> <para> Note that this function is case-sensitive. For case-insensitive searches, use <function>stristr</function>. </para> </note> </para> <para> <example> <title>Ukázka <function>Strstr</function></title> <programlisting role="php"> $email = 'sterling@designmultimedia.com'; $domain = strstr ($email, '@'); print $domain; // prints @designmultimedia.com </programlisting> </example> </para> <para> Viz také <function>stristr</function>, <function>strrchr</function>, <function>substr</function>, and <function>ereg</function>. </para> </refsect1> </refentry> <refentry id="function.strtok"> <refnamediv> <refname>strtok</refname> <refpurpose>Tokenize string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtok</function></funcdef> <paramdef>string <parameter>arg1</parameter></paramdef> <paramdef>string <parameter>arg2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>strtok</function> is used to tokenize a string. That is, if you have a string like "This is an example string" you could tokenize this string into its individual words by using the space character as the token. <example> <title>Ukázka <function>Strtok</function></title> <programlisting role="php"> $string = "This is an example string"; $tok = strtok ($string," "); while ($tok) { echo "Word=$tok<br>"; $tok = strtok (" "); } </programlisting> </example> </para> <para> Note that only the first call to strtok uses the string argument. Every subsequent call to strtok only needs the token to use, as it keeps track of where it is in the current string. To start over, or to tokenize a new string you simply call strtok with the string argument again to initialize it. Note that you may put multiple tokens in the token parameter. The string will be tokenized when any one of the characters in the argument are found. </para> <para> Also be careful that your tokens may be equal to "0". This evaluates to false in conditional expressions. </para> <para> Viz také <function>split</function> and <function>explode</function>. </para> </refsect1> </refentry> <refentry id="function.strtolower"> <refnamediv> <refname>strtolower</refname> <refpurpose>Zmìnit øetìzec na malá písmena</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtolower</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí <parameter>string</parameter> se vemi abecedními znaky zmìnìnými na malá písmena </para> <para> Pozn.: co je 'abecední' je dáno aktuálním místním nastavením. Napøíklad ve standardním místním nastavení "C" se znaky jako pøehlasované a (Ä) nepøevedou. </para> <example> <title>Ukázka <function>Strtolower</function></title> <programlisting role="php"> $str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtolower($str); print $str; # vytiskne mary had a little lamb and she loved it so </programlisting> </example> <para> Viz také <function>strtoupper</function> a <function>ucfirst</function>. </para> </refsect1> </refentry> <refentry id="function.strtoupper"> <refnamediv> <refname>strtoupper</refname> <refpurpose>Zmìnit øetìzec na velká písmena</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtoupper</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí <parameter>string</parameter> se vemi abecedními znaky zmìnìnými na velká písmena. </para> <para> Pozn.: co je 'abecední' je dáno aktuálním místním nastavením. Napøíklad ve standardním místním nastavení "C" se znaky jako pøehlasované a (ä) nepøevedou. </para> <example> <title>Ukázka <function>strtoupper</function></title> <programlisting role="php"> $str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtoupper ($str); print $str; # vytiskne MARY HAD A LITTLE LAMB AND SHE LOVED IT SO </programlisting> </example> <para> Viz také <function>strtolower</function> a <function>ucfirst</function>. </para> </refsect1> </refentry> <refentry id="function.str-replace"> <refnamediv> <refname>str_replace</refname> <refpurpose> Nahradit vechny výskyty jednoho øetìzce v jiném dalím øetìzcem </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>str_replace</function></funcdef> <paramdef>string <parameter>needle</parameter></paramdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>haystack</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce nahradí vechny výskyty argumentu <parameter>needle</parameter> v <parameter>haystack</parameter> argumentem <parameter>str</parameter>. Pokud nepotøebujete sloitá pravidla pro nahrazování, mìli byste vdy pouít tuto funkci místo <function>ereg_replace</function>. </para> <para> <example> <title>Ukázka <function>str_replace</function></title> <programlisting role="php"> $bodytag = str_replace ("%body%", "black", "<body text=%body%>"); </programlisting> </example> </para> <para> Tato funkce je XXX binárnì bezpeèná. </para> <note> <para> <function>Str_replace</function> was added in PHP 3.0.6, but was buggy up until PHP 3.0.8. </para> </note> <para> Viz také <function>ereg_replace</function> and <function>strtr</function>. </para> </refsect1> </refentry> <refentry id="function.strtr"> <refnamediv> <refname>strtr</refname> <refpurpose>Pøeloit urèité znaky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtr</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>from</parameter></paramdef> <paramdef>string <parameter>to</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce upraví <parameter>str</parameter> tak, e vechny výskyty vech znakù ve <parameter>from</parameter> pøeloí na odpovídající znaky v <parameter>to</parameter> a vrátí výsledek. </para> <para> Pokud jsou <parameter>from</parameter> a <parameter>to</parameter> rùznì dlouhé, pøebývající znaky z delího z tìch dvou se ignorují. <example> <title>Ukázka <function>strtr</function></title> <programlisting role="php"> $addr = strtr($addr, "äåö", "aao"); </programlisting> </example> </para> <para> <function>strtr</function> se dá také volat pouze se dvìma argumenty. Pøi volání se dvìma argumenty se chová takto: <parameter>from</parameter> musí být pole obsahující páry øetìzcù, které se zamìní ve zdrojovém øetìzci. <function>strtr</function> vdy hledá nejdelí monou shodu a *NENAHRAZUJE* ty èásti øetìzce, na kterých u pracovala. </para> <para> Ukázky: <informalexample> <programlisting role="php"> $trans = array ("ahoj" => "nazdar", "nazdar" => "ahoj"); echo strtr("nazdar lidi, øekl jsem ahoj", $trans) . "\n"; </programlisting> </informalexample> Výsledek: "ahoj lidi, øekl jsem nazdar", </para> <note> <simpara> Tato vlastnost (dva argumenty) byla pøidána v PHP 4.0. </simpara> </note> <para> Viz také <function>ereg_replace</function>. </para> </refsect1> </refentry> <refentry id="function.substr"> <refnamediv> <refname>substr</refname> <refpurpose>Vrátit èást øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>substr</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter>start</parameter></paramdef> <paramdef>int <parameter><optional>length</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>substr</function> vrátí èást argumentu <parameter>string</parameter> urèenou argumenty <parameter>start</parameter> a <parameter>length</parameter>. </para> <para> Pokud je <parameter>start</parameter> pozitivní, vrácený øetìzec zaène <parameter>start</parameter>-tým znakem øetìzce <parameter>string</parameter>, poèítáno od nuly. Napøíklad v øetìzci '<literal>abcdef</literal>' je znakem na <literal>0</literal>-té pozici '<literal>a</literal>', znakem na pozici <literal>2</literal> je '<literal>c</literal>', atd. </para> <para> Pøíklady: <informalexample> <programlisting role="php"> $rest = substr ("abcdef", 1); // vrátí "bcdef" $rest = substr ("abcdef", 1, 3); // vrátí "bcd" </programlisting> </informalexample> </para> <para> Pokud je <parameter>start</parameter> negativní, vrácený øetìzec zaène <parameter>start</parameter>-tým znakem od konce argumentu <parameter>string</parameter>. </para> <para> Pøíklady: <informalexample> <programlisting role="php"> $rest = substr ("abcdef", -1); // vrátí "f" $rest = substr ("abcdef", -2); // vrátí "ef" $rest = substr ("abcdef", -3, 1); // vrátí "d" </programlisting> </informalexample> </para> <para> Pokud je argument <parameter>length</parameter> kladný, vrácený øetìzec skonèí <parameter>length</parameter> znakù od <parameter>start</parameter>. Pokud by to znamenalo øetìzec se zápornou délkou (<parameter>start</parameter> je za <parameter>length</parameter>), vrácený øetìzec bude sestávat z jediného znaku na pozici <parameter>start</parameter>. </para> <para> Pokud je argument <parameter>length</parameter> kladný, vrácený øetìzec skonèí <parameter>length</parameter> znakù od konce argumentu <parameter>string</parameter>. Pokud by to znamenalo øetìzec se zápornou délkou, vrácený øetìzec bude sestávat z jediného znaku na pozici <parameter>start</parameter>. </para> <para> Pøíklady: <informalexample> <programlisting role="php"> $rest = substr ("abcdef", 1, -1); // vrátí "bcde" </programlisting> </informalexample> </para> <para> Viz také <function>strrchr</function> a <function>ereg</function>. </para> </refsect1> </refentry> <refentry id="function.substr-count"> <refnamediv> <refname>substr_count</refname> <refpurpose>Spoèítat poèet výskytù øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>substr_count</function></funcdef> <paramdef>string <parameter>haystrack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>substr_count</function> vrátí poèet výskytù øetìzce <parameter>needle</parameter> v øetìzci <parameter>haystack</parameter> string. </para> <para> <example> <title>Ukázka <function>substr_count</function></title> <programlisting> print substr_count("This is a test", "is"); // prints out 2 </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.substr-replace"> <refnamediv> <refname>substr_replace</refname> <refpurpose>Nahradit èást øetìzce jiným øetìzcem</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>substr_replace</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>string <parameter>replacement</parameter></paramdef> <paramdef>int <parameter>start</parameter></paramdef> <paramdef>int <parameter><optional>length</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>substr_replace</function> nahradí èást øetìzce <parameter>string</parameter> ohranièenou argumenty <parameter>start</parameter> a (volitelnì) <parameter>length</parameter> øetìzcem v argumentu <parameter>replacement</parameter>. Vrátí výsledek. </para> <para> Pokud je <parameter>start</parameter> pozitivní, náhrada zaène na <parameter>start</parameter>-tém znaku argumentu <parameter>string</parameter>. </para> <para> Pokud je <parameter>start</parameter> negativní, náhrada zaène na <parameter>start</parameter>-tém znaku od konce argumentu <parameter>string</parameter>. </para> <para> Pokud je pøítomen <parameter>length</parameter>, a je pozitivní, pøedstavuje délku èásti argumentu <parameter>string</parameter>, která bude nahraena. Pokud je negativní, pøedstavuje poèet znakù od konce <parameter>string</parameter>, kde má nahrazování skonèit. Pokud pøítomen není, bere se standardnì strlen( <parameter>string</parameter> ); tj. nahrazování konèí na konci argumentu <parameter>string</parameter>. </para> <para> <example> <title>Ukázka <function>Substr_replace</function></title> <programlisting role="php"> <?php $var = 'ABCDEFGH:/MNRPQR/'; echo "Originál: $var<hr>\n"; /* Tyto dva pøíklady nahradí celý obsah promìnné $var øetìzcem 'bob'. */ echo substr_replace ($var, 'bob', 0) . "<br>\n"; echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; /* Toto vloí 'bob' na zaèátek $var. */ echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; /* Tyto dva pøíklady nahradí 'MNRPQR' ve $var øetìzcem 'bob'. */ echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; /* Toto z $var odstraní 'MNRPQR'. */ echo substr_replace ($var, '', 10, -1) . "<br>\n"; ?> </programlisting> </example> </para> <para> Viz také <function>str_replace</function> a <function>substr</function>. </para> <note> <simpara> Funkce <function>substr_replace</function> byla pøidána v PHP 4.0. </simpara> </note> </refsect1> </refentry> <refentry id="function.trim"> <refnamediv> <refname>trim</refname> <refpurpose> Odstranit netisknutelné znaky ze zaèátku a konce øetìzce </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>trim</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce odstraní netisknutelné znaky ze zaèátku a konce øetìzce a vrátí øetìzec bez tìchto znakù. Netisknutelné znaky, které se v souèasnosti odstraòují, jsou: "\n", "\r", "\t", "\v", "\0", a mezera. </para> <para> Viz také <function>chop</function>, <function>rtrim</function> a <function>ltrim</function>. </para> </refsect1> </refentry> <refentry id="function.ucfirst"> <refnamediv> <refname>ucfirst</refname> <refpurpose>Make a string's first character uppercase</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ucfirst</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Capitalizes the first character of <parameter>str</parameter> if that character is alphabetic. </para> <para> Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted. <example> <title>Ukázka <function>Ucfirst</function></title> <programlisting role="php"> $text = 'mary had a little lamb and she loved it so.'; $text = ucfirst ($text); // $text is now Mary had a little lamb // and she loved it so. </programlisting> </example> </para> <para> Viz také <function>strtoupper</function> and <function>strtolower</function>. </para> </refsect1> </refentry> <refentry id="function.ucwords"> <refnamediv> <refname>ucwords</refname> <refpurpose> Uppercase the first character of each word in a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ucwords</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Capitalizes the first character of each word in <parameter>str</parameter> if that character is alphabetic. <example> <title>Ukázka <function>ucwords</function></title> <programlisting role="php"> $text = "mary had a little lamb and she loved it so."; $text = ucwords($text); // $text is now: Mary Had A Little // Lamb And She Loved It So. </programlisting> </example> <note> <simpara> The definition of a word is any string of characters that is immediately after a whitespace (These are: space, form-feed, newline, carriage return, horizontal tab, and vertical tab). </simpara> </note> </para> <para> Viz také <function>strtoupper</function>, <function>strtolower</function> and <function>ucfirst</function>. </para> </refsect1> </refentry> <refentry id="function.wordwrap"> <refnamediv> <refname>wordwrap</refname> <refpurpose> Wraps a string to a given number of characters using a string break character. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>wordwrap</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>int <parameter><optional>width</optional></parameter> </paramdef> <paramdef>string <parameter><optional>break</optional></parameter> </paramdef> <paramdef>int <parameter><optional>cut</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Wraps the string <parameter>str</parameter> at the column number specified by the (optional) <parameter>width</parameter> parameter. The line is broken using the (optional) <parameter>break</parameter> parameter. </para> <para> <function>wordwrap</function> will automatically wrap at column 75 and break using '\n' (newline) if <parameter>width</parameter> or <parameter>break</parameter> are not given. </para> <para> If the <parameter>cut</parameter> is set to 1, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken appart. (See second example). <note> <para> The <parameter>cut</parameter> parameter was added in PHP 4.0.3. </para> </note> </para> <para> <example> <title>Ukázka <function>wordwrap</function></title> <programlisting role="php"> $text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap( $text, 20 ); echo "$newtext\n"; </programlisting> </example> </para> <para> This example would display: </para> <para> <informalexample> <programlisting> The quick brown fox jumped over the lazy dog. </programlisting> </informalexample> </para> <para> <example> <title>Ukázka <function>wordwrap</function></title> <programlisting role="php"> $text = "A very long woooooooooooord."; $newtext = wordwrap( $text, 8, "\n", 1); echo "$newtext\n"; </programlisting> </example> </para> <para> This example would display: </para> <para> <informalexample> <programlisting> A very long wooooooo ooooord. </programlisting> </informalexample> </para> <para> Viz také <function>nl2br</function>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/url.xml +++ phpdoc/cs/functions/url.xml <reference id="ref.url"> <title>URL Functions</title> <titleabbrev>URLs</titleabbrev> <refentry id="function.base64-decode"> <refnamediv> <refname>base64_decode</refname> <refpurpose>Dekódovat data kódovaná pomocí MIME base64</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>base64_decode</function></funcdef> <paramdef>string <parameter>encoded_data</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Base64_decode</function> dekóduje <parameter>encoded_data</parameter> a vrátí pùvodní data. Vrácená data mohou být binární </para> <para> Viz také: <function>base64_encode</function>, RFC 2045 sekce 6.8. </para> </refsect1> </refentry> <refentry id="function.base64-encode"> <refnamediv> <refname>base64_encode</refname> <refpurpose>Zakódovat data pomocí MIME base64</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>base64_encode</function></funcdef> <paramdef>string <parameter>data</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Base64_encode</function> vrátí <parameter>data</parameter> zakódovaný pomocí base64. Toto kódování je navreno tak, aby umonilo binárním datùm pøeít transport pøenosovými vrstvami, které nejsou osmibitové, jako jsou napøíklad tìla emailù. </para> <para> Data kódovaná pomocí base64 zabírají o zhruba 33% prostoru více ne pùvodní data. </para> <para> Viz také: <function>base64_decode</function>, <function>chunk_split</function>, RFC-2045 sekce 6.8. </para> </refsect1> </refentry> <refentry id="function.parse-url"> <refnamediv> <refname>parse_url</refname> <refpurpose>Rozebrat URL a vrátit její komponenty</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>parse_url</function></funcdef> <paramdef>string <parameter>url</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí asociativní pole vech komponent URL pøítomnych v <parameter>url</parameter>. Ty mohou být: "scheme", "host", "port", "user", "pass", "path", "query" a "fragment". </para> </refsect1> </refentry> <refentry id="function.rawurldecode"> <refnamediv> <refname>rawurldecode</refname> <refpurpose>Dekódovat URL-kódovaný øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>rawurldecode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec, ve kterém sekvence znaku procent (<literal>%</literal>) následových dvìma estnáctkovými èíslicemi byly nahrazeny prostými znaky. Napøíklad øetìzec <screen>foo%20bar%40baz</screen> dekóduje na <screen>foo bar@baz</screen>. </para> <simpara> Viz také: <function>rawurlencode</function>, <function>urldecode</function>, <function>urlencode</function>. </simpara> </refsect1> </refentry> <refentry id="function.rawurlencode"> <refnamediv> <refname>rawurlencode</refname> <refpurpose>URL-kódovat podle RFC1738</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>rawurlencode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec, ve kterém byly vechny nealfanumerické znaky kromì <screen>-_.</screen> nahrazeny znakem procent (<literal>%</literal>) následovaným dvìma estnáctkovými èíslicemi. To je kódování popsané v RFC1738 na ochranu prostých znakù pøed interpretací jako zvlátní oddìlovaèe v URL a na ochranu URL pøed komolením pøenosovými systémy se znakovými konvencemi (jako jsou nìkteré emailové systémy). Napøíklad, pokud chcete k FTP URL pøidat heslo: <example> <title>Pøíklad <function>rawurlencode</function> è. 1</title> <programlisting role="php"> echo '<A HREF="ftp://user:', rawurlencode ('foo @+%/'), '@ftp.my.com/x.txt">'; </programlisting> </example> Nebo, pokud pøedáváte informace v komponentì URL obsahující info o cestì: <example> <title>Pøíklad <function>rawurlencode</function> è. 2</title> <programlisting role="php"> echo '<A HREF="http://x.com/department_list_script/', rawurlencode ('sales and marketing/Miami'), '">'; </programlisting> </example> </para> <simpara> Viz také: <function>rawurldecode</function>, <function>urldecode</function>, <function>urlencode</function>. </simpara> </refsect1> </refentry> <refentry id="function.urldecode"> <refnamediv> <refname>urldecode</refname> <refpurpose>Dekódovat URL-kódovaný øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>urldecode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Dekóduje vechny <literal>%<replaceable>##</replaceable></literal> kódy v daném øetìzci. Vrátí dekódovaný øetìzec. <example> <title>Pøíklad <function>urldecode</function></title> <programlisting role="php"> $a = split ('&', $querystring); $i = 0; while ($i < count ($a)) { $b = split ('=', $a [$i]); echo 'Hodnota argumentu ', htmlspecialchars (urldecode ($b [0])), ' je ', htmlspecialchars (urldecode ($b [1])), "<BR>"; $i++; } </programlisting> </example> </para> <para> Viz také <function>urlencode</function>, <function>rawurlencode</function>, <function>rawurldecode</function>. </para> </refsect1> </refentry> <refentry id="function.urlencode"> <refnamediv> <refname>urlencode</refname> <refpurpose>URL-kódovat øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>urlencode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec, ve kterém byly vechny nealfanumerické znaky kromì <literal>-_.</literal> nahrazeny znakem procent (<literal>%</literal>) následovaným dvìma estnácktovými èíslicemi a mezery kódovány jako znaky plus (<literal>+</literal>). Kódování je stejné jako u dat postovaných z WWW formuláøe, tj. stejnì jako u <literal>application/x-www-form-urlencoded</literal> typu. To se lií od RFC1738 kódování (viz <function>rawurlencode</function>) v tom, e z historických dùvodù se mezery kódují jako znaky plus (<literal>+</literal>). Tato funkce je vhodná pøi kódování øetìzce, který se má pouít jako query èást URL jako pøíhodný zpùsob pøedání promìnných na dalí stránku: <example> <title>Pøíklad <function>Urlencode</function></title> <programlisting role="php"> echo '<A HREF="mycgi?foo=', urlencode ($userinput), '">'; </programlisting> </example> </para> <para> Poznámka: pozor pøi pøedávání promìnných, které by mohly odpovídat HTML entitám. Vìci jako &amp, &copy a &pound browser analyzuje a místo poadovaného jména promìnné pouije odpovídající entitu. To je zøejmý problém, na který W3C upozoròuje u léta. Pøíruèka je tady: <ulink url="&url.argsep;">&url.argsep;</ulink> PHP podporuje zmìnu oddìlovaèe argumentù na støedník doporuèovaný W3C skrze .ini direktivu arg_separator. Bohuel, vìtina uivatelských programù neposílá data z formuláøù v tomto formátu. Pøenositelnìjí formou je pouít jako oddìlovaè &amp; místo &. Na to nemusíte mìnit arg_separator. Nechte ho na &, ale kódujte URL pomocí <function>htmlentities</function> (urlencode($data)). <example> <title>Pøíklad na <function>urlencode/htmlentities</function></title> <programlisting role="php"> echo '<A HREF="mycgi?foo=', htmlentities (urlencode ($userinput) ), '">'; </programlisting> </example> </para> <para> Viz také <function>urldecode</function>, <function>htmlentities</function>, <function>rawurldecode</function>, <function>rawurlencode</function>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: -->
Index: phpdoc/cs/functions/apache.xml +++ phpdoc/cs/functions/apache.xml <reference id="ref.apache"> <title>Funkce specifické pro Apache</title> <titleabbrev>Apache</titleabbrev> <refentry id="function.apache-lookup-uri"> <refnamediv> <refname>apache_lookup_uri</refname> <refpurpose> Provádí èásteèný poadavek na zadanou URI a vrací vechno info o ní </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>class <function>apache_lookup_uri</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce provádí èásteèný poadavek na URI. Jde jen tak daleko, aby získala vechny dùleité informace o daném zdroji a vrací tyto informace ve tøídì. Vlastnosti této tøídy jsou: <simplelist> <member>status</member> <member>the_request</member> <member>status_line</member> <member>method</member> <member>content_type</member> <member>handler</member> <member>uri</member> <member>filename</member> <member>path_info</member> <member>args</member> <member>boundary</member> <member>no_cache</member> <member>no_local_copy</member> <member>allowed</member> <member>send_bodyct</member> <member>bytes_sent</member> <member>byterange</member> <member>clength</member> <member>unparsed_uri</member> <member>mtime</member> <member>request_time</member> </simplelist> </para> <note> <simpara> <function>Apache_lookup_uri</function> pouze, pokud je PHP nainstalováno jako modul Apache. </simpara> </note> </refsect1> </refentry> <refentry id="function.apache-note"> <refnamediv> <refname>apache_note</refname> <refpurpose>Získává a nastavuje poznámky poadavku u Apache.</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>apache_note</function></funcdef> <paramdef>string <parameter>note_name</parameter></paramdef> <paramdef>string <parameter> <optional>note_value</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>Apache_note</function> je funkce specifická pro Apache, která získává a nastavuje hodnoty v tabulce <literal>poznámek</literal> poadavku. Pøi volání s jedním argumentem vrací souèasnou hodnotu poznámky <literal>note_name</literal>. Pøi volání se dvìma argumenty nastavuje hodnotu poznámky <literal>note_name</literal> na <literal>note_value</literal>, a vrací pøedchozí hodnotu poznámky <literal>note_name</literal>. </para> </refsect1> </refentry> <refentry id="function.getallheaders"> <refnamediv> <refname>getallheaders</refname> <refpurpose>Získává vechny hlavièky HTTP poadavku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>getallheaders</function></funcdef> <paramdef>void<parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrací asociativní pole vech HTTP hlavièek v souèasném poadavku. </para> <para> <note> <para> Hodnotu bìných CGI promìnných mùete také získat tím, e je pøeètete z prostøedí, co funguje, a pouíváte PHP jako modu Apache nebo ne. Pokud chcete vidìt seznam vech systémových promìnných definovaných tímto zpùsobem, pouijte <function>phpinfo</function>. </para> </note> </para> <para> <example> <title><function>getallheaders</function> Example</title> <programlisting role="php"> $headers = getallheaders(); while (list ($header, $value) = each ($headers)) { echo "$header: $value<br>\n"; } </programlisting> </example> </para> <para> Tento pøíklad zobrazí vechny hlavièky souèasného poadavku. <note> <simpara> <function>Getallheaders</function> je v souèasnosti podporována jen kdy PHP bìí jako modul <productname>Apache</productname>. </simpara> </note> </para> </refsect1> </refentry> <refentry id="function.virtual"> <refnamediv> <refname>virtual</refname> <refpurpose>Provádí sub-poadavek Apache</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>virtual</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Virtual</function> je funkce specifická pro Apache ekvivalentní s <!--#include virtual...--> v mod_include. Provádí sub-poadavek Apache. Je uiteèná pro vkládání CGI skriptù nebo .shtml souborù, nebo èehokoliv jiného, co má Apache parsovat. CGI skripty musí generovat platné CGI hlavièky. To znamená, e musí pøinejmením generovat Content-type hlavièku. Pro PHP soubory musíte pouít <function>include</function> nebo <function>require</function>; <function>virtual</function> se nedá pouít k vloení dokumentu, který je sám PHP skriptem. </para> </refsect1> </refentry> <refentry id="function.ascii2ebcdic"> <refnamediv> <refname>ascii2ebcdic</refname> <refpurpose>Pøekládá øetìzec z ASCII do EBCDIC</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ascii2ebcdic</function></funcdef> <paramdef>string <parameter>ascii_str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>ascii2ebcdic</function> je funkce specifická pro Apache dostupná pouze na operaèních systémech zaloených na EBCDIC (OS/390, BS2000). Pøekládá (binárnì bezpeènì) øeìzec v ASCII kódování <parameter>ascii_str</parameter> na jeho ekvivalentní EBCDIC reprezentaci, a vrací výsledek. </para> <para> Viz také opaènou funkci <function>ebcdic2ascii</function> </para> </refsect1> </refentry> <refentry id="function.ebcdic2ascii"> <refnamediv> <refname>ebcdic2ascii</refname> <refpurpose>Pøekládá øetìzec z EBCDIC do ASCII</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ebcdic2ascii</function></funcdef> <paramdef>string <parameter>ebcdic_str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>ebcdic2ascii</function> je funkce specifická pro Apache dostupná pouze na operaèních systémech zaloených na EBCDIC (OS/390, BS2000). Pøekládá (binárnì bezpeènì) øeìzec v kódování EBCDIC <parameter>ascii_str</parameter> na jeho ekvivalentní ASCII reprezentaci, a vrací výsledek. </para> <para> Viz také opaènou funkci <function>ascii2ebcdic</function> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/aspell.xml +++ phpdoc/cs/functions/aspell.xml <reference id="ref.aspell"> <title>Aspell funkce</title> <titleabbrev>Aspell</titleabbrev> <partintro> <simpara> <function>aspell</function> funkce umoòují ovìøit hláskování slova a nabídnout moné opravy. </simpara> <note> <simpara> aspell funguje pouze s velmi starými (do pøiblinì .27.*) verzemi aspell knihovny. Tento modul, ani tyto verze aspell knihovny u nejsou podporovány. Pokud chcete v PHP pouít kontrolu hláskování, pouijte místo toho <link linkend="ref.pspell">pspell</link>. Vyuívá pspell knihovnu, a pracuje s novìjími verzemi aspellu. </simpara> </note> <simpara> Budete potøebovat aspell knihovnu dostupnou z: <ulink url="&url.aspell;">&url.aspell;</ulink>. </simpara> </partintro> <refentry id="function.aspell-new"> <refnamediv> <refname>aspell_new</refname> <refpurpose>Naèíst nový slovník</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>aspell_new</function></funcdef> <paramdef>string <parameter>master</parameter></paramdef> <paramdef>string <parameter>personal</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_new</function> otevøe nový slovník, a vrátí identifikátor spojení na tento slovník vyuitelný s dalími aspell funkcemi. </simpara> <para> <example> <title><function>Aspell_new</function></title> <programlisting role="php"> $aspell_link=aspell_new ("english"); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.aspell-check"> <refnamediv> <refname>aspell_check</refname> <refpurpose>Zkontrolovat slovo</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>aspell_check</function></funcdef> <paramdef>int <parameter>dictionary_link</parameter></paramdef> <paramdef>string <parameter>word</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_check</function> zkontroluje hláskování slova a vrátí <literal>true</literal>, pokud je hláskování správné, a <literal>false</literal>, pokud není. </simpara> <para> <example> <title><function>Aspell_check</function></title> <programlisting> $aspell_link=aspell_new ("english"); if (aspell_check ($aspell_link, "testt")) { echo "Toto je platné hláskování"; } else { echo "Pardon, patné hláskování"; } </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.aspell-check-raw"> <refnamediv> <refname>aspell_check_raw</refname> <refpurpose> Zkontrolovat slovo beze zmìny velikosti písmen nebo pokusù o oøezání </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>aspell_check_raw</function></funcdef> <paramdef>int <parameter>dictionary_link</parameter></paramdef> <paramdef>string <parameter>word</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_check_raw</function> zkontroluje hláskování slova beze zmìn velikosti písmen nebo pokusù ho jakýmkoliv zpùsobem oøezat, a vrátí <literal>true</literal>, pokud je hláskování správné, a <literal>false</literal>, pokud není. </simpara> <para> <example> <title><function>Aspell_check_raw</function></title> <programlisting role="php"> $aspell_link=aspell_new ("english"); if (aspell_check_raw ($aspell_link, "test")) { echo "Toto je platné hláskování"; } else { echo "Pardon, patné hláskování"; } </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.aspell-suggest"> <refnamediv> <refname>aspell_suggest</refname> <refpurpose>Nabídnout moné hláskování slova</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>aspell_suggest</function></funcdef> <paramdef>int <parameter>dictionary_link</parameter></paramdef> <paramdef>string <parameter>word</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Aspell_suggest</function> vrátí pole moných hláskování daného slova. </simpara> <para> <example> <title><function>Aspell_suggest</function></title> <programlisting role="php"> $aspell_link=aspell_new ("english"); if (!aspell_check ($aspell_link, "test")) { $suggestions=aspell_suggest ($aspell_link, "test"); for ($i=0; $i < count ($suggestions); $i++) { echo "Moné hláskování: " . $suggestions[$i] . "<br>"; } } </programlisting> </example> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/bc.xml +++ phpdoc/cs/functions/bc.xml <reference id="ref.bc"> <title>BCMath funkce pro výpoèty s libovolnou pøesností</title> <titleabbrev>BC math</titleabbrev> <partintro> <para> Tyto funkce jsou dostupné pouze pokud bylo PHP zkonfigurováno s <option role="configure">--enable-bcmath</option>. </para> </partintro> <refentry id="function.bcadd"> <refnamediv> <refname>bcadd</refname> <refpurpose>Seèíst dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcadd</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Pøiète <parameter>left operand</parameter> k <parameter>right operand</parameter> a vrátí souèet v øetìzci. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcsub</function>. </para> </refsect1> </refentry> <refentry id="function.bccomp"> <refnamediv> <refname>bccomp</refname> <refpurpose>Porovnat dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>bccomp</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Porovná <parameter>left operand</parameter> s <parameter>right operand</parameter> a vrátí výsledek jako integer. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst pouitých pøi porovnání. Návratová hodnota je 0, pokud jsou si oba operandy rovné. Pokud je <parameter>left operand</parameter> vìtí ne <parameter>right operand</parameter>, návratová hodnota je +1, a pokud je <parameter>left operand</parameter> mení ne <parameter>right operand</parameter>, návratová hodnota je -1. </para> </refsect1> </refentry> <refentry id="function.bcdiv"> <refnamediv> <refname>bcdiv</refname> <refpurpose>Dìlit dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcdiv</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Vydìlí argument <parameter>left operand</parameter> argumentem <parameter>right operand</parameter> a vrátí výsledek. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcmul</function>. </para> </refsect1> </refentry> <refentry id="function.bcmod"> <refnamediv> <refname>bcmod</refname> <refpurpose>Získat modulus èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcmod</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>modulus</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí modulus argumentu <parameter>left operand</parameter> s pouitím argumentu <parameter>modulus</parameter>. </para> <para> Viz také <function>bcdiv</function>. </para> </refsect1> </refentry> <refentry id="function.bcmul"> <refnamediv> <refname>bcmul</refname> <refpurpose>Vynásobit dvì èísla s libovolnou pøesností</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcmul</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Vynásobí argument <parameter>left operand</parameter> argumentem <parameter>right operand</parameter> a vrátí výsledek. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcdiv</function>. </para> </refsect1> </refentry> <refentry id="function.bcpow"> <refnamediv> <refname>bcpow</refname> <refpurpose> Umocnit jedno èíslo na jiné s libovolnou pøesností </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcpow</function></funcdef> <paramdef>string <parameter>x</parameter></paramdef> <paramdef>string <parameter>y</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Umocní <parameter>x</parameter> na <parameter>y</parameter>. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcsqrt</function>. </para> </refsect1> </refentry> <refentry id="function.bcscale"> <refnamediv> <refname>bcscale</refname> <refpurpose>Nastavit výchozí kálu pro vechny bc math funkce </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcscale</function></funcdef> <paramdef>int <parameter>scale</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce nastaví výchozí kálu pro vechna následná volání bc math funkcí, ktera neudávají explicitnì kálu pøesnosti. </para> </refsect1> </refentry> <refentry id="function.bcsqrt"> <refnamediv> <refname>bcsqrt</refname> <refpurpose> Získat druhou odmocninu èísla s libovolnou pøesností </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcsqrt</function></funcdef> <paramdef>string <parameter>operand</parameter></paramdef> <paramdef>int <parameter>scale</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí druhou odmocninu argumentu <parameter>operand</parameter>. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcpow</function>. </para> </refsect1> </refentry> <refentry id="function.bcsub"> <refnamediv> <refname>bcsub</refname> <refpurpose> Odeèíst jedno èíslo od druhého s libovolnou pøesností </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bcsub</function></funcdef> <paramdef>string <parameter>left operand</parameter></paramdef> <paramdef>string <parameter>right operand</parameter></paramdef> <paramdef>int <parameter><optional>scale</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Odeète argument <parameter>right operand</parameter> od argumentu <parameter>left operand</parameter> a vrátí výsledek v øetìzci. Volitelný argument <parameter>scale</parameter> se pouívá k urèení poètu desetinných míst ve výsledku. </para> <para> Viz také <function>bcadd</function>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/com.xml +++ phpdoc/cs/functions/com.xml <reference id="ref.com"> <title>Funkce na podporu COM ve Windows</title> <titleabbrev>COM</titleabbrev> <partintro> <simpara> Tyto funkce jsou dostupné pouze ve Windows verzi PHP. Tyto funkce byly pøidány v PHP 4. </simpara> </partintro> <refentry id="function.com-load"> <refnamediv> <refname>com_load</refname> <refpurpose> Creates a new reference to a COM component </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>com_load</function></funcdef> <paramdef>string <parameter>module name</parameter></paramdef> <paramdef>string <parameter> <optional>server name</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>com_load</function> vytváøí novou COM komponentu a vrací odkaz na ni. Pøi neúspìchu vrací <literal>false</literal>. </para> </refsect1> </refentry> <refentry id="function.com-invoke"> <refnamediv> <refname>com_invoke</refname> <refpurpose> Volá metodu COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>com_invoke</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>function_name</parameter></paramdef> <paramdef>mixed <parameter> <optional>function parameters, ...</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>Com_invoke</function> volá metodu COM komponenty odkazované <parameter>com_object</parameter>. Pokud dojde k chybì, vrací <literal>false</literal>, pøi úspìchu vrací návratovou hodnotu metody <parameter>function_name</parameter>. </para> </refsect1> </refentry> <refentry id="function.com-propget"> <refnamediv> <refname>com_propget</refname> <refpurpose> Získává hodnotu vlastnosti COM komponenty </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>com_propget</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je alias k <function>com_get</function>. </para> </refsect1> </refentry> <refentry id="function.com-get"> <refnamediv> <refname>com_get</refname> <refpurpose> Získává hodnotu vlastnosti COM komponenty </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>com_get</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací hodnotu <parameter>property</parameter> COM komponenty odkazované <parameter>com_object</parameter>. Pøi chybì vrací <literal>false</literal>. </para> </refsect1> </refentry> <refentry id="function.com-propput"> <refnamediv> <refname>com_propput</refname> <refpurpose> Pøiøazuje hodnotu vlastnosti COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>com_propput</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je alias ke <function>com_set</function>. </para> </refsect1> </refentry> <refentry id="function.com-propset"> <refnamediv> <refname>com_propset</refname> <refpurpose> Pøiøazuje hodnotu vlastnosti COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>com_propset</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je alias ke <function>com_set</function>. </para> </refsect1> </refentry> <refentry id="function.com-set"> <refnamediv> <refname>com_set</refname> <refpurpose> Pøiøazuje hodnotu vlastnosti COM komponenty. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>com_set</function></funcdef> <paramdef>resource <parameter>com_object</parameter></paramdef> <paramdef>string <parameter>property</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Nastavuje hodnotu vlastnosti <parameter>property</parameter> COM komponent odkazované <parameter>com_object</parameter>. Vrací <literal>true</literal>, pokud je <parameter>property</parameter> nastaveno. Pøi chybì vrací <literal>false</literal>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/dir.xml +++ phpdoc/cs/functions/dir.xml <reference id="ref.dir"> <title>Adresáøové funkce</title> <titleabbrev>Adresáøe</titleabbrev> <refentry id="function.chdir"> <refnamediv> <refname>chdir</refname> <refpurpose>change directory</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>chdir</function></funcdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Mìní aktuální adresáø PHP na <parameter>directory</parameter>. Pokud se nepodaøilo zmìnít adresáø, vrací FALSE, jinak TRUE. </para> </refsect1> </refentry> <refentry id="class.dir"> <refnamediv> <refname>dir</refname> <refpurpose>directory class</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>new <function>dir</function></funcdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pseudo-objektovì orientovaný mechanismus pro ètení adresáøe. Otevøe zadaný <parameter>directory</parameter>. Po otevøení adresáøe jsou pøístupné dvì vlastnosti. Vlastnost handle je pouitelná s jinými adresáøovými funkcemi jako <function>readdir</function>, <function>rewinddir</function> a <function>closedir</function>. Hodnotou vlastnosti path je cesta k otevøenému adresáøi. Dále jsou pøístupné tøi metody: read, rewind a close. <example> <title><function>Dir</function> pøíklad</title> <programlisting role="php"> $d = dir("/etc"); echo "Handle: ".$d->handle."<br>\n"; echo "Path: ".$d->path."<br>\n"; while($entry=$d->read()) { echo $entry."<br>\n"; } $d->close(); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.closedir"> <refnamediv> <refname>closedir</refname> <refpurpose>Zavírá otevøený adresáø</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>closedir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Zavírá proud z adresáøe specifikovaný v <parameter>dir_handle</parameter>. Proud musí pocházet z funkce <function>opendir</function>. </para> </refsect1> </refentry> <refentry id="function.getcwd"> <refnamediv> <refname>getcwd</refname> <refpurpose>Získává aktuální pracovní adresáø</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>getcwd</function></funcdef> <void/> </funcprototype> </funcsynopsis> <para> Vrací aktuální pracovní adresáø. </para> </refsect1> </refentry> <refentry id="function.opendir"> <refnamediv> <refname>opendir</refname> <refpurpose>Otevøe adresáø</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>opendir</function></funcdef> <paramdef>string <parameter>path</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací deskriptor adresáøe pouitelný v následných voláních <function>closedir</function>, <function>readdir</function>, a <function>rewinddir</function>. </para> </refsect1> </refentry> <refentry id="function.readdir"> <refnamediv> <refname>readdir</refname> <refpurpose>Pøeète poloku z deskriptoru adresáøe</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>readdir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací název dalího souboru v adresáøi. Názvy souborù nejsou nijak tøídìny. <example> <title>Vypi vechny soubory v adresáøi</title> <programlisting role="php"> // Note that !== did not exist until 4.0.0-RC2 <?php $handle=opendir('.'); echo "Directory handle: $handle\n"; echo "Files:\n"; while (($file = readdir($handle))!==false) { echo "$file\n"; } closedir($handle); ?> </programlisting> </example> </para> <para> Vimnìte si, e <function>readdir</function> vráí také . a .. poloky. Pokud je nechcete, mùete je snadno vynechat: <example> <title> Vypi vechny soubory v adresáøi a vynech . a .. </title> <programlisting role="php"> <?php $handle=opendir('.'); while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file\n"; } } closedir($handle); ?> </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.rewinddir"> <refnamediv> <refname>rewinddir</refname> <refpurpose>rewind directory handle</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>rewinddir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Resets the directory stream indicated by <parameter>dir_handle</parameter> to the beginning of the directory. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/dl.xml +++ phpdoc/cs/functions/dl.xml <reference id="ref.dl"> <title>Funkce pro dynamické naèítání</title> <titleabbrev>Dyn. naèítání</titleabbrev> <refentry id="function.dl"> <refnamediv> <refname>dl</refname> <refpurpose>naète extenzi PHP za bìhu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>dl</function></funcdef> <paramdef>string <parameter>library</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Naète extenzi PHP definovanou v <parameter>library</parameter>. Viz také konfiguraèní direktivu <link linkend="ini.extension-dir">extension_dir</link>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/filepro.xml +++ phpdoc/cs/functions/filepro.xml <reference id="ref.filepro"> <title>filePro funkce</title> <titleabbrev>filePro</titleabbrev> <partintro> <simpara> Tyto funkce umoòují read-only (pouze pro ètení) pøístup k datùm uloeným ve filePro databázích. </simpara> <simpara> filePro je registrovaná obchodní znaèka Fiserv, Inc. Více informací o filePro najdete na <ulink url="&url.filepro;">&url.filepro;</ulink>. </simpara> </partintro> <refentry id="function.filepro"> <refnamediv> <refname>filepro</refname> <refpurpose>Pøeèíst a ovìøit mapový soubor</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>bool <function>filepro</function></funcdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Pøeète a ovìøí mapový soubor a uloí poèet sloupcù a info.</para> <para> Nedochází k zamykání, take byste se mìli vyhnout úpravám vaí filePro databáze, pokud mùe být otevøena v PHP. </para> </refsect1> </refentry> <refentry id="function.filepro-fieldname"> <refnamediv> <refname>filepro_fieldname</refname> <refpurpose>Zjistit název sloupce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>filepro_fieldname</function></funcdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí název sloupce odpovídajícího <parameter>field_number</parameter>. </para> </refsect1> </refentry> <refentry id="function.filepro-fieldtype"> <refnamediv> <refname>filepro_fieldtype</refname> <refpurpose>Zjistit typ sloupce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>filepro_fieldtype</function></funcdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí editaèní typ sloupce odpovídajícího <parameter>field_number</parameter>. </para> </refsect1> </refentry> <refentry id="function.filepro-fieldwidth"> <refnamediv> <refname>filepro_fieldwidth</refname> <refpurpose>Zjistit íøku sloupce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>filepro_fieldwidth</function></funcdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí íøku sloupce odpovídajícího <parameter>field_number</parameter>. </para> </refsect1> </refentry> <refentry id="function.filepro-retrieve"> <refnamediv> <refname>filepro_retrieve</refname> <refpurpose>Získat data z filePro databáze</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>filepro_retrieve</function></funcdef> <paramdef>int <parameter>row_number</parameter></paramdef> <paramdef>int <parameter>field_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Vrátí data z urèeného místa v databázi.</para> </refsect1> </refentry> <refentry id="function.filepro-fieldcount"> <refnamediv> <refname>filepro_fieldcount</refname> <refpurpose>Zjistit, kolik sloupcù je ve filePro databázi</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>filepro_fieldcount</function></funcdef> <void/> </funcprototype> </funcsynopsis> <para>Vrátí poèet polí (sloupcù) v otevøené filePro databázi.</para> <para> Viz také <function>filepro</function>.</para> </refsect1> </refentry> <refentry id="function.filepro-rowcount"> <refnamediv> <refname>filepro_rowcount</refname> <refpurpose>Zjistit, kolik øádkù je ve filePro databázi</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>filepro_rowcount</function></funcdef> <void/> </funcprototype> </funcsynopsis> <para>Vrátí poèet øádkù v otevøené filePro databázi.</para> <para> Viz také <function>filepro</function>.</para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/gettext.xml +++ phpdoc/cs/functions/gettext.xml <reference id="ref.gettext"> <title>GNU Gettext</title> <titleabbrev>gettext</titleabbrev> <partintro> <simpara> Gettext funkce implementujíc NLS (Native Language Support) API, která se dá pouít k internacionalizaci vaich PHP aplikací. Dùkladné vysvìtlení tìchto funkcí viz dokumentaci GNU Gettext. </simpara> </partintro> <refentry id="function.bindtextdomain"> <refnamediv> <refname>bindtextdomain</refname> <refpurpose>Nastavit cestu pro doménu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bindtextdomain</function></funcdef> <paramdef>string <parameter>domain</parameter></paramdef> <paramdef>string <parameter>directory</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Funkce <function>bindtextdomain</function> nastaví cestu pro doménu. </para> </refsect1> </refentry> <refentry id="function.dcgettext"> <refnamediv> <refname>dcgettext</refname> <refpurpose>Zmìnit doménu pro jediné vyhledání</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>dcgettext</function></funcdef> <paramdef>string <parameter>domain</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> <paramdef>int <parameter>category</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vám umoní zmenit souèasnou doménu pro jediné vyhledání zprávy. Umoòuje také specifikovat kategorii. </para> </refsect1> </refentry> <refentry id="function.dgettext"> <refnamediv> <refname>dgettext</refname> <refpurpose>Zmìnit souèasnou doménu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>dgettext</function></funcdef> <paramdef>string <parameter>domain</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Funkce <function>dgettext</function> umoòuje zmìnit souèasnou doménu pro jediné vyhledání zprávy. </para> </refsect1> </refentry> <refentry id="function.gettext"> <refnamediv> <refname>gettext</refname> <refpurpose>Vyhledat zprávu v souèasné doménì</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>gettext</function></funcdef> <paramdef>string <parameter>message</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí pøeloený øetìzec, pokud jej najde v pøekladové tabulce, nebo pøedaný øetìzec, pokud jej nenajde. Jako alias k této funkci mùete pouít podtrítko. </para> <example> <title><function>Gettext</function>-check</title> <programlisting> <?php // Set language to German putenv ("LANG=de"); // Specify location of translation tables bindtextdomain ("myPHPApp", "./locale"); // Choose domain textdomain ("myPHPApp"); // Print a test message print (gettext ("Vítejte v mé PHP Aplikaci")); ?> </programlisting> </example> </refsect1> </refentry> <refentry id="function.textdomain"> <refnamediv> <refname>textdomain</refname> <refpurpose>Nastavit výchozí doménu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>textdomain</function></funcdef> <paramdef>string <parameter>text_domain</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce nastaví doménu pro vyhledávání pøi volání funkce <function>gettext</function>, obvykle pojmenovanou podle aplikace. Vrátí pøedchozí výchozí doménu. Pøi volání bez argumentù vrátí souèasné nastavení, ani by jej mìnila. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/http.xml +++ phpdoc/cs/functions/http.xml <reference id="ref.http"> <title>HTTP funkce</title> <titleabbrev>HTTP</titleabbrev> <partintro> <simpara> Tyto funkce vám umoòují manipulovat výstupem posílaným zpìt browseru pøímo na úrovni HTTP protokolu. </simpara> </partintro> <refentry id="function.header"> <refnamediv> <refname>header</refname> <refpurpose>Poslat HTTP hlavièku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>header</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Funkce <function>Header</function> se pouívá na zaèátku HTML souboru k odeslání HTTP hlavièek. Více informací o HTTP hlavièkách viz <ulink url="&spec.http1.1;">Specifikace HTTP 1.1</ulink>. <emphasis>Poznámka:</emphasis> Pamatujte, e funkce <function>Header</function> musí být volána døíve ne se odele jakýkoliv normální výstup, a u normálními HTML tagy, nebo z PHP. Velmi obvyklou chybou je naèítat kód pomocí <function>include</function> nebo auto_prepend a mít v tomto kódu prázdné øádky, které zpùsobí odeslání výstupu pøed voláním funkce <function>header</function>. </para> <para> Existují dva zvlátní pøípady volání funkce <function>header</function>. Prvním je hlavièka "Location". Ta nejene odele hlavièku browseru, ale navíc i vrátí Apachi stavový kód REDIRECT. Z pohledu autora skriptu by to nemìlo být dùleité, ale je to dùleité pro lidi, kteøí rozumí vnitønostem Apache. <informalexample> <programlisting role="php"> header ("Location: http://www.php.net"); /* Pøesmìrujeme browser na web site PHP */ exit; /* Pojistíme si, e se dalí kód nevykoná po pøesmìrování. */ </programlisting> </informalexample> </para> <para> Druhým zvlátním pøípadem jsou vechny hlavièky zaèínající øetìzcem "HTTP/" (velikost písmen nehraje roli). Napøíklad, pokud direktiva ErrorDocument 404 vaeho Apache ukazuje na PHP skript, nebylo by od vìci, kdyby skuteènì generoval 404. První vìcí, kterou byste v tomto skriptu mìli udìlat tudíz bude: <informalexample> <programlisting role="php"> header ("HTTP/1.0 404 Not Found"); </programlisting> </informalexample> </para> <para> PHP skripty èasto generují dynamické HTML, které nesmí být cachováno uivatelským browserem, ani ýdnými proxynami mezi serverem a uivatelským browserem. Mnoho proxyn a klientù se dá donutit k vypnutí cachování s pomocí <informalexample> <programlisting role="php"> header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // datum v minulosti header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // vdy upraven header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 </programlisting> </informalexample> </para> <para> Viz také <function>headers_sent</function> </para> </refsect1> </refentry> <refentry id="function.headers-sent"> <refnamediv> <refname>headers_sent</refname> <refpurpose>Vrátit true, pokud byly odeslány hlavièky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>headers_sent</function></funcdef> <paramdef><parameter>void</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí <literal>true</literal>, pokud u byly HTTP hlavièky odeslány, jinak <literal>false</literal>. </para> <para> Viz také <function>header</function> </para> </refsect1> </refentry> <refentry id="function.setcookie"> <refnamediv> <refname>setcookie</refname> <refpurpose>Poslat cookie</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>setcookie</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> <paramdef>string <parameter><optional>value</optional></parameter> </paramdef> <paramdef>int <parameter><optional>expire</optional></parameter> </paramdef> <paramdef>string <parameter><optional>path</optional></parameter> </paramdef> <paramdef>string <parameter><optional>domain</optional></parameter> </paramdef> <paramdef>int <parameter><optional>secure</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>Setcookie</function> definuje cookie, který se pole spolu s hlavièkami. Cookies se musí odeslat jako <emphasis>první</emphasis> ze vech HTTP hlavièek (to je omezení cookies, ne PHP). Volání této funkce musíte tudí umístit pøed <literal><html></literal> èi <literal><head></literal> tagy. </para> <para> Vechny argumenty kromì argumentu <parameter>name</parameter> jsou nepovinné. Pokud je pøítomný pouze argument <parameter>name</parameter>, u klienta se smae cookie tohoto jména. Kterýkoliv argument mùete také nahradit prázdným øetìzcem (<emphasis>""</emphasis>), èím tento argument pøeskoèíte. Argumenty <parameter>expire</parameter> a <parameter>secure</parameter> jsou celoèíselné a nedají se pøeskoèit prázdným øetìzcem. Místo toho pouijte nulu (<emphasis>0</emphasis>). Argument <parameter>expire</parameter> je bìné Unixové celoèíselné vyjádøení èasu, jak je vrací funkce <function>time</function> èi <function>mktime</function>. Argument <parameter>secure</parameter> indikuje, e by se tento cookie mìl pøenáet pouze po zabezpeèeném HTTPS spojení. </para> <para> Bìné zádrhele: <itemizedlist> <listitem> <simpara> Cookies jsou pøístupné a pøi dalím naètení stránky, na které pøístupné být mají. </simpara> </listitem> <listitem> <simpara> Cookies se musí mazat se stejnými parametry, se kterými byly odeslány. </simpara> </listitem> </itemizedlist> </para> <simpara> V PHP 3 se vícenásobná volání <function>setcookie</function> v jednom skriptu provedou v opaèném poøadí. Pokud se pokouíte smazat jeden cookie pøe odesláním jiného, mìli byste umístit vloení pøed smazání. V PHP 4 se vícenásobná volání <function>setcookie</function> provedou v tom poøadí, jak jsou volána. </simpara> <para> Nìkolik pøíkladù, jak posílat cookies: <example> <title>Ukázky odeslání cookies pomocí <function>setcookie</function></title> <programlisting role="php"> setcookie ("TestCookie", "Zkuební hodnota"); setcookie ("TestCookie", $value,time()+3600); /* vyprí za hodinu */ setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1); </programlisting> </example> </para> <para> Následují pøíklady mazání cookies z pøedchozí ukázky: <example> <title>Ukázky mazání cookies pomocí <function>setcookie</function></title> <programlisting role="php"> setcookie ("TestCookie"); // nastaví dobu vyprení na èas pøed hodinou setcookie ("TestCookie", "", time() - 3600); setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".utoronto.ca", 1); </programlisting> </example> Pøi mazání cookie byste se mìli ujistit, e je doba vyprení v minulosti, èím se v browseru zapne mechanismus odstranìní cookie. </para> <para> Vimnìte si, e hodnotová èást cookie se pøi odeslání cookie automaticky url-zakóduje, a pøi pøijetí se automaticky dekóduje a pøiøadí promìnné stejného jména, jako je jméno cookie. Pokud chcete vidìt obsah naeho zkuebního cookie, pouijte nìkterý z následujících pøíkladù: <informalexample> <programlisting role="php"> echo $TestCookie; echo $HTTP_COOKIE_VARS["TestCookie"]; </programlisting> </informalexample> </para> <para> Cookies obsahující pole mùete také odeslat tak, e za název cookie napíete hranaté závorky. Úèinkem tohoto je odeslání tolika cookies, kolik má vae pole prvkù, ale kdy vá skript tyto cookies pøijme, hodnoty se umístí v poli stejného jména, jako jsou vae cookies: <informalexample> <programlisting role="php"> setcookie ("cookie[three]", "cookiethree"); setcookie ("cookie[two]", "cookietwo"); setcookie ("cookie[one]", "cookieone"); if (isset ($cookie)) { while (list ($name, $value) = each ($cookie)) { echo "$name == $value<br>\n"; } } </programlisting> </informalexample> </para> <para> Více informací o cookies viz specifikace cookies na <ulink url="&spec.cookies;">&spec.cookies;</ulink>. </para> <simpara> Microsoft Internet Explorer 4 se Service Packem 1 zpracovává chybnì cookies, které mají nastavený argument <parameter>path</parameter>. </simpara> <simpara> Netscape Communicator 4.05 a Microsoft Internet Explorer 3.x zøejmì nezpracují cookies správnì, pokud nejsou nastaveny argumenty <parameter>path</parameter> a <parameter>time</parameter>. </simpara> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/info.xml +++ phpdoc/cs/functions/info.xml <reference id="ref.info"> <title>PHP volby & informace</title> <titleabbrev>PHP volby/info</titleabbrev> <refentry id="function.assert"> <refnamediv> <refname>assert</refname> <refpurpose>Ovìøit, jestli je výrok neplatný</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>assert</function></funcdef> <paramdef>string|bool <parameter>assertion</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>assert</function> ovìøí pøedanou <parameter>assertion</parameter> a provede pøíslunou akci, pokud je výsledek <literal>false</literal>. </para> <para> Pokud je pøedaná <parameter>assertion</parameter> øetìzec, vyhodnotí se funkcí <function>assert</function> jako PHP kód. Výhody øetìzcové <parameter>assertion</parameter> jsou mení reie, kdy je kontrola výrokù vypnutá, a zprávy obsahující <parameter>assertion</parameter> výraz, kdy výrok sele. </para> <para> Kontrola výrokù by se mìla pouívat jen pro odlaïování skriptù. Mùete je pouít na kontrolu podmínek, které by mìly být vdycky true, a které jinak indikují nìjaké chyby v programování, nebo na kontrolu existence urèitých vlastností, jako jsou funkce obsaené v extenzích, nebo urèité systémové limity a vlastnosti. </para> <para> Výroky by se nemìly pouívat pro bìné operace jako kontrola vstupních parametrù. Jako základní pravidlo platí, e vá kód by mìl fungovat správnì, pokud není kontrola výrokù aktivována. </para> <para> Chování funkce <function>assert</function> lze konfigurovat skrze <function>assert_options</function> nebo .ini direktivy popsané na manuálové stránce této funkce. </para> </refsect1> </refentry> <refentry id="function.assert-options"> <refnamediv> <refname>assert_options</refname> <refpurpose>Nastavit/získat rùzné pøíznaky výrokù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>assert_options</function></funcdef> <paramdef>int <parameter>what</parameter></paramdef> <paramdef>mixed <parameter><optional>value</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> S pouitím funkce <function>assert_options</function> mùete nastavit rùzné øídící volby funkce <function>assert</function>, nebo jen získat jejich souèasné nastavení. </para> <table> <title>Volby výrokù</title> <tgroup cols="4"> <thead> <row> <entry>volba</entry> <entry>ini parametr</entry> <entry>výchozí hodnota</entry> <entry>popis</entry> </row> </thead> <tbody> <row> <entry>ASSERT_ACTIVE</entry> <entry>assert.active</entry> <entry>1</entry> <entry>zapne <function>assert</function> vyhodnocování</entry> </row> <row> <entry>ASSERT_WARNING</entry> <entry>assert.warning</entry> <entry>1</entry> <entry>vytvoøí PHP varování pro kadý selhaví výrok</entry> </row> <row> <entry>ASSERT_BAIL</entry> <entry>assert.bail</entry> <entry>0</entry> <entry>ukonèí provádìní skiptu, pokud výrok sele</entry> </row> <row> <entry>ASSERT_QUIET_EVAL</entry> <entry>assert.quiet_eval</entry> <entry>0</entry> <entry> vypne error_reporting bìhem vyhodnocování výrazù výrokù </entry> </row> <row> <entry>ASSERT_CALLBACK</entry> <entry>assert_callback</entry> <entry>(null)</entry> <entry>uivatelská funkce, která se zavolá pro kadý selhaví výrok</entry> </row> </tbody> </tgroup> </table> <para> <function>assert_options</function> vrací pùvodní nastavení volby, nebo <literal>false</literal> pøi chybì. </para> </refsect1> </refentry> <refentry id="function.extension-loaded"> <refnamediv> <refname>extension_loaded</refname> <refpurpose>zjistit, jestli je extenze naètená</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>bool <function>extension_loaded</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrací true, pokud je extenze identifikovaná argumentem <parameter>name</parameter> naètena. Názvy rùzných extenzí mùete vidìt, pokud pouijete <function>phpinfo</function>. </simpara> <para> Viz také <function>phpinfo</function>. <note> <para> Tato funkce byla pøidána v PHP 3.0.10. </para> </note> </para> </refsect1> </refentry> <refentry id="function.dl"> <refnamediv> <refname>dl</refname> <refpurpose>Naèíst extenzi PHP za bìhu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>dl</function></funcdef> <paramdef>string <parameter>library</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Naète extenzi PHP definovanou v <parameter>library</parameter>. Viz také konfiguraèní direktivu <link linkend="ini.extension-dir">extension_dir</link>. </para> </refsect1> </refentry> <refentry id="function.getenv"> <refnamediv> <refname>getenv</refname> <refpurpose>Získat hodnotu systémové promìnné</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>getenv</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí hodnotu systémové promìnné <parameter>varname</parameter>, nebo false pøi chybì. <informalexample> <programlisting> $ip = getenv ("REMOTE_ADDR"); // získá IP adresu uivatele </programlisting> </informalexample> </para> <para> Seznam vech systémových promìnných si mùete prohlédnout pouitím <function>phpinfo</function>. Význam mnoha z nich najdete v <ulink url="&url.cgispecs;">CGI specifikaci</ulink>, zvlátì na <ulink url="&url.cgispec;">stránce o systémových promìnných</ulink>. <note> <para> Tato funkce nefunguje v ISAPI módu. </para> </note> </para> </refsect1> </refentry> <refentry id="function.get-cfg-var"> <refnamediv> <refname>get_cfg_var</refname> <refpurpose>Získat hodnotu volby z konfigurace PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>get_cfg_var</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí souèasnou hodnotu konfiguraèní promìnné PHP urèené argumentem <parameter>varname</parameter>, nebo false pokud dojde k chybì. </simpara> <simpara> Nevrací konfiguraèní hodnoty nastavené pøi kompilaci PHP a neète konfiguraèní soubor Apache (pouití php3_configuration_option direktiv). </simpara> <simpara> Pokud chcete zjistit, jestli daný systém pouívá <link linkend="configuration.file">konfiguraèní soubor</link>, zkuste získat hodnotu konfiguraèní volby cfg_file_path. Pokud je tato dostupná, pouívá se konfiguraèní soubor. </simpara> </refsect1> </refentry> <refentry id="function.get-current-user"> <refnamediv> <refname>get_current_user</refname> <refpurpose>Získat jméno vlastníka souèasného PHP skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>get_current_user</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí jméno vlastníka souèasného PHP skriptu. </simpara> <simpara> Viz také <function>getmyuid</function>, <function>getmypid</function>, <function>getmyinode</function>, a <function>getlastmod</function>. </simpara> </refsect1> </refentry> <refentry id="function.get-magic-quotes-gpc"> <refnamediv> <refname>get_magic_quotes_gpc</refname> <refpurpose>Získat souèasné aktivní nastavení magic_quotes_gpc</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>long <function>get_magic_quotes_gpc</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí souèasné aktivní nastavení <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>. (0 pro vypnuto, 1 pro zapnuto). </simpara> <simpara> Viz také <function>get_magic_quotes_runtime</function>, <function>set_magic_quotes_runtime</function>. </simpara> </refsect1> </refentry> <refentry id="function.get-magic-quotes-runtime"> <refnamediv> <refname>get_magic_quotes_runtime</refname> <refpurpose>Vrátit souèasné aktivní nastavení magic_quotes_runtime</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>long <function>get_magic_quotes_runtime</function> </funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí souèasné aktivní nastavení <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>. (0 pro vypnuto, 1 pro zapnuto). </simpara> <simpara> Viz také <function>get_magic_quotes_gpc</function>, <function>set_magic_quotes_runtime</function>. </simpara> </refsect1> </refentry> <refentry id="function.getlastmod"> <refnamediv> <refname>getlastmod</refname> <refpurpose>Získat èas poslení modifikace skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getlastmod</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí èas poslení modifikace souèasné stránky. Návratová hodnota je Unixový timestamp, vhodný jako vstup pro <function>date</function>. Pøi chybì vrací false. <example> <title>getlastmod() pøíklad</title> <programlisting role="php"> // outputs e.g. 'Last modified: March 04 1998 20:43:59.' echo "Last modified: ".date ("F d Y H:i:s.", getlastmod()); </programlisting> </example> </para> <para> See alse <function>date</function>, <function>getmyuid</function>, <function>get_current_user</function>, <function>getmyinode</function>, and <function>getmypid</function>. </para> </refsect1> </refentry> <refentry id="function.getmyinode"> <refnamediv> <refname>getmyinode</refname> <refpurpose>Získat inode souèasného skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getmyinode</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí inode souèasného skriptu, nebo false pøi chybì. </para> <para> Viz také <function>getmyuid</function>, <function>get_current_user</function>, <function>getmypid</function>, and <function>getlastmod</function>. </para> <note> <simpara> Tato funkce není podporována na Windows systémech. </simpara> </note> </refsect1> </refentry> <refentry id="function.getmypid"> <refnamediv> <refname>getmypid</refname> <refpurpose>Získat process ID PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getmypid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí process ID souèasného PHP procesu, nebo false pøi chybì. </para> <warning> <para> Process ID nejsou unikátní, a jsou tudí slabým zdrojem entropie. Nedoporuèujeme pouívat PIDy v prostøedích závislých na bezpeènosti. </para> </warning> <para> Viz také <function>getmyuid</function>, <function>get_current_user</function>, <function>getmyinode</function>, a <function>getlastmod</function>. </para> </refsect1> </refentry> <refentry id="function.getmyuid"> <refnamediv> <refname>getmyuid</refname> <refpurpose>Získat UID majitele PHP skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>getmyuid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí user ID souèasného skriptu, nebo false pøi chybì. </simpara> <simpara> Viz také <function>getmypid</function>, <function>get_current_user</function>, <function>getmyinode</function>, a <function>getlastmod</function>. </simpara> </refsect1> </refentry> <refentry id="function.getrusage"> <refnamediv> <refname>getrusage</refname> <refpurpose>Získat informace o souèasném vyuití zdrojù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>getrusage</function></funcdef> <paramdef>int <parameter><optional>who</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Toto je rozhraní ke to getrusage(2). Vrátí asociativní pole obsahující vechna data vrácená systémovým voláním. Pokud je who 1, getrusage se zavolá s RUSAGE_CHILDREN. </para> <para> Vechny poloky jsou pøístupné skrze svá dokumentovaná jména. <example> <title>Getrusage pøíklad</title> <programlisting role="php"> $dat = getrusage(); echo $dat["ru_nswap"]; # poèet swapù echo $dat["ru_majflt"]; # poèet page faultù echo $dat["ru_utime.tv_sec"]; # vyuitý uivatelský èas (sekundy) echo $dat["ru_utime.tv_usec"]; # vyuitý uivatelský èas (mikrosekundy) </programlisting> </example> Dalí detaily viz man stránka getrusage(2) na vaem systému. </para> </refsect1> </refentry> <refentry id="function.ini-alter"> <refnamediv> <refname>ini_alter</refname> <refpurpose>Zmìnit hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_alter</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> <paramdef>string <parameter>newvalue</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Zmìní hodnotu konfiguraèní volby, vrátí <literal>false</literal> pøi selhání, a pøedchozí hodnotu konfiguraèní volby pøi úspìchu. </para> <note> <para> Toto je alias k <function>ini_set</function> </para> </note> <para> Viz také <function>ini_get</function>, <function>ini_restore</function>, <function>ini_set</function> </para> </refsect1> </refentry> <refentry id="function.ini-get"> <refnamediv> <refname>ini_get</refname> <refpurpose>Získat hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_get</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí hodnotu konfiguraèní volby pøi úspìchu, <literal>false</literal> pøi selhání. </para> <para> Viz také <function>ini_alter</function>, <function>ini_restore</function>, <function>ini_set</function> </para> </refsect1> </refentry> <refentry id="function.ini-restore"> <refnamediv> <refname>ini_restore</refname> <refpurpose>Obnovit pùvodní hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_restore</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Obnoví pùvodní hodnotu konfiguraèní volby. </para> <para> Viz také <function>ini_alter</function>, <function>ini_get</function>, <function>ini_set</function> </para> </refsect1> </refentry> <refentry id="function.ini-set"> <refnamediv> <refname>ini_set</refname> <refpurpose>Zmìnit hodnotu konfiguraèní volby</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ini_set</function></funcdef> <paramdef>string <parameter>varname</parameter></paramdef> <paramdef>string <parameter>newvalue</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Zmìní hodnotu konfiguraèní volby, vrátí <literal>false</literal> pøi selhání, a pøedchozí hodnotu konfiguraèní volby pøi úspìchu. </para> <para> Viz také <function>ini_alter</function>, <function>ini_get</function>, <function>ini_restore</function> </para> </refsect1> </refentry> <refentry id="function.phpcredits"> <refnamediv> <refname>phpcredits</refname> <refpurpose>Vytisknout credits pro PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>phpcredits</function></funcdef> <paramdef>int <parameter>flag</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vytiskne credits vè. seznamu vývojáøù PHP, modulù, atd. Generuje pøísluný HTML kód, kterým se tyto informace vkládají do stránky. Je tøeba pøedat argument indikující co se vytiskne (pøeddefinovaná konstanta flag, viz níe). Napøíklad k vytitìní veobecných credits mùete nìkde ve svém kódu pouít: <informalexample> <programlisting role="php"> ... phpcredits(CREDITS_GENERAL); ... </programlisting> </informalexample> A pokud chcete vytisknout uí kruh vývojáøù a dokumentaèní skupinu na samostatné stránce, pouijte: <informalexample> <programlisting role="php"> <?php phpcredits(CREDITS_GROUP + CREDITS_DOCS + CREDITS_FULLPAGE); ?> </programlisting> </informalexample> A pokud chcete vloit vechny credits do vlastní stránky, pomùe vám následující kód: <informalexample> <programlisting role="php"> <html> <head> <title>Má stránka s credits</title> </head> <body> <?php // vá vlastní kód phpcredits(CREDITS_ALL + CREDITS_FULLPAGE); // dalí kód ?> </body> </html> </programlisting> </informalexample> </para> <para> </para> <para> <table> <title>Pøeddefinované <function>phpcredits</function> pøíznaky</title> <tgroup cols="2"> <thead> <row> <entry>název</entry> <entry>popis</entry> </row> </thead> <tbody> <row> <entry>CREDITS_ALL</entry> <entry> Vechny credits, ekvivalentní k: CREDITS_DOCS + CREDITS_GENERAL + CREDITS_GROUP + CREDITS_MODULES + CREDITS_FULLPAGE. Vygeneruje kompletní samostatnou HTML stránku s pøíslunými tagy. </entry> </row> <row> <entry>CREDITS_DOCS</entry> <entry>Credits dokumentaèního týmu</entry> </row> <row> <entry>CREDITS_FULLPAGE</entry> <entry> Obvykle se pouívá v kombinaci s jinými pøíznaky. Indikuje, e se má vytisknout kompletní samostatná HTML stránka, vèetnì informací indikovaných jinými pøíznaky. </entry> </row> <row> <entry>CREDITS_GENERAL</entry> <entry> Veobecné credits: Design a koncept jazyka, autoøi PHP 4.0 a SAPI modul. </entry> </row> <row> <entry>CREDITS_GROUP</entry> <entry>Seznam uího kruhu vývojáøù</entry> </row> <row> <entry>CREDITS_MODULES</entry> <entry>Seznam roziøujících modulù (extenzí) PHP a jejich autorù</entry> </row> <row> <entry>CREDITS_SAPI</entry> <entry>Seznam server API modulù PHP a jejich autorù</entry> </row> </tbody> </tgroup> </table> </para> <para> Viz také <function>phpinfo</function>, <function>phpversion</function>, <function>php_logo_guid</function>. </para> </refsect1> </refentry> <refentry id="function.phpinfo"> <refnamediv> <refname>phpinfo</refname> <refpurpose>Vytisknout spoustu informací o PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>phpinfo</function></funcdef> <paramdef>int <parameter><optional>what</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vytiskne velké mnoství informací o souèasném stavu PHP. To zahrnuje informace o kompilaèních volbách a extenzích, verzi PHP, informaci o serveru a systémù (pokud je PHP zkompilováno jako modul), PHP prostøedí, verzi OS, cesty, hlavní a lokální hodnoty konfiguraèních voleb, HTTP hlavièky, a PHP licenci. </para> <para> Výstup se dá upravit pøedáním jednou nebo více z následujících hodnot uloených ve volitelném argumentu <parameter>what</parameter>. <itemizedlist> <listitem><simpara>INFO_GENERAL</simpara></listitem> <listitem><simpara>INFO_CREDITS</simpara></listitem> <listitem><simpara>INFO_CONFIGURATION</simpara></listitem> <listitem><simpara>INFO_MODULES</simpara></listitem> <listitem><simpara>INFO_ENVIRONMENT</simpara></listitem> <listitem><simpara>INFO_VARIABLES</simpara></listitem> <listitem><simpara>INFO_LICENSE</simpara></listitem> <listitem><simpara>INFO_ALL</simpara></listitem> </itemizedlist> </para> <para> Viz také <function>phpversion</function>, <function>phpcredits</function>, <function>php_logo_guid</function> </para> </refsect1> </refentry> <refentry id="function.phpversion"> <refnamediv> <refname>phpversion</refname> <refpurpose>Získat souèasnou verzi PHP</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>phpversion</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec obsahující verzi právì bìícího PHP parseru. <example> <title>phpversion() example</title> <programlisting role="php"> // prints e.g. 'Souèasná verze PHP: 3.0rel-dev' echo "Souèasná verze PHP: ".phpversion(); </programlisting> </example> </para> <para> Viz také <function>phpinfo</function>, <function>phpcredits</function>, <function>php_logo_guid</function> </para> </refsect1> </refentry> <refentry id="function.php-logo-guid"> <refnamediv> <refname>php_logo_guid</refname> <refpurpose>Get the logo guid</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>php_logo_guid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <note> <para> Tato funkcionalita byla pøidána v PHP 4 Beta 4. </para> </note> </para> <para> Viz také <function>phpinfo</function>. <function>phpversion</function>, <function>phpcredits</function> </para> </refsect1> </refentry> <refentry id="function.php-sapi-name"> <refnamediv> <refname>php_sapi_name</refname> <refpurpose> Vrátit typ rozhraní mezi web serverem a PHP Returns the type of interface between web server and PHP </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>php_sapi_name</function></funcdef> <void/> </funcprototype> </funcsynopsis> <simpara> <function>php_sapi_name</function> vrátí øetìzec popisující malými písmeny typ rozhraní mezi web serverem a PHP (Server API, SAPI). U CGI PHP je tento øetìzec "cgi", u mod_php pro Apache je tento øetìzec "apache" a tak dále. </simpara> <para> <example> <title><function>Php_sapi_name</function> Example</title> <programlisting role="php"> $sapi_type = php_sapi_name(); if ($sapi_type == "cgi") print "Pouíváte CGI PHP\n"; else print "Nepouíváte CGI PHP\n"; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.php-uname"> <refnamediv> <refname>php_uname</refname> <refpurpose> Vrátit informaci o operaèním systému, na kterém bylo PHP zkompilováno </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>php_uname</function></funcdef> <void/> </funcprototype> </funcsynopsis> <simpara> <function>php_uname</function> vrátí øetìzec s popisem operaèního systému, na kterém bylo PHP zkompilováno. </simpara> <para> <example> <title><function>php_uname</function> Example</title> <programlisting role="php"> if (substr(php_uname(), 0, 7) == "Windows") { die("Pardon, tento skript na Windows nefunguje.\n"); } </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.putenv"> <refnamediv> <refname>putenv</refname> <refpurpose>Nastavit hodnotu systémové promìnné</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>putenv</function></funcdef> <paramdef>string <parameter>setting</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pøidá <parameter>setting</parameter> do prostøedí serveru. </para> <para> <example> <title>Nastavení systémové promìnné</title> <programlisting role="php"> putenv ("UNIQID=$uniqid"); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.set-magic-quotes-runtime"> <refnamediv> <refname>set_magic_quotes_runtime</refname> <refpurpose> Nastavit souèasnou aktivní hodnotu magic_quotes_runtime </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>long <function>set_magic_quotes_runtime</function> </funcdef> <paramdef>int <parameter>new_setting</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Nastaví souèasnou aktivní konfiguraèní volby <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>. (0 vypnuto, 1 zapnuto) </simpara> <simpara> Viz také <function>get_magic_quotes_gpc</function>, <function>get_magic_quotes_runtime</function>. </simpara> </refsect1> </refentry> <refentry id="function.set-time-limit"> <refnamediv> <refname>set_time_limit</refname> <refpurpose>Omezit maximální dobu prùbìhu skriptu</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>set_time_limit</function></funcdef> <paramdef>int <parameter>seconds</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Urèí poèet sekund po které mùe skript bìet. Pokud je dosaeno tohoto èasu, skript vrátí fatální chybu. Standardní limit je 30 sekund, nebo, pokud existuje, hodnota direktivy max_execution_time definovaná v <link linkend="configuration.file">konfiguraèním souboru</link>. Pokud je <parameter>seconds<-parameter> nula, neexistuje ádný èasový limit. </simpara> <simpara> <function>set_time_limit</function> pøi svém zavolání restartuje èítaè èasu od nuly. Jinými slovy, pokud je limit standardních é sekund a po 25 sekundách provádìní skriptu dojde k volání set_time_limit(20), tento skript pobìí celkem 45 sekund pøedtím, ne skonèí na èasovém limitu. </simpara> <simpara> Vimnìte si, e <function>set_time_limit</function> nemá ádný úèinek, kdy PHP bìí v bezpeèném módu. Obejít to lz jedine vypnutím bezpeèného módu nebo zmìnou èasového limitu v <link linkend="configuration.file">konfiguraèním souboru</link>. </simpara> </refsect1> </refentry> <refentry id="function.zend-logo-guid"> <refnamediv> <refname>zend_logo_guid</refname> <refpurpose>Získat zend guid</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>zend_logo_guid</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <note> <para> Tato funkcionalita byla pøidána v PHP 4 Beta 4. </para> </note> </para> </refsect1> </refentry> <refentry id="function.get-loaded-extensions"> <refnamediv> <refname>get_loaded_extensions</refname> <refpurpose> Vrátit pole se jmény vech zkompilovaných a naètených modulù (extenzí) </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_loaded_extensions</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrací jména vech modulù (extenzí) zkompilovaných a naètených do PHP interpretru. </para> <para> Napøíklad následující øádek <informalexample> <programlisting> print_r (get_loaded_extensions()); </programlisting> </informalexample> vypíe seznam podobný tomuto: <informalexample> <programlisting> Array ( [0] => xml [1] => wddx [2] => standard [3] => session [4] => posix [5] => pgsql [6] => pcre [7] => gd [8] => ftp [9] => db [10] => Calendar [11] => bcmath ) </programlisting> </informalexample> </para> <para> Viz také: <function>get_extension_funcs</function>. </para> </refsect1> </refentry> <refentry id="function.get-extension-funcs"> <refnamediv> <refname>get_extension_funcs</refname> <refpurpose> Vrátit pole jmen funkcí urèitého modulu </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_extension_funcs</function></funcdef> <paramdef>string <parameter>module_name</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrací jména vech funkcí definovaných v modulu urèeném argumentem <parameter>module_name</parameter>. </para> <para> Napøíklad následující øádky <informalexample> <programlisting> print_r (get_extension_funcs ("xml")); print_r (get_extension_funcs ("gd")); </programlisting> </informalexample> vytisknou seznam vech funkcí v modulech <varname>xml</varname> a <varname>gd</varname>. </para> <para> Viz také: <function>get_loaded_extensions</function> </para> </refsect1> </refentry> <refentry id="function.get-required-files"> <refnamediv> <refname>get_required_files</refname> <refpurpose> Vrátit pole jmen vech souborù, které byly v urèitém skriptu naèteny pomocí require_once() </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_required_files</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí asociativní pole jmen vech souborù, které byly naèteny do probíhajícího skriptu pomocí <function>require_once</function>. Indexy tohoto pole jsou názvy souborù pouitých v <function>require_once</function> bez pøípony ".php". </para> <para> Následující pøíklad <example> <title>Tisk require()ovaných a include()ovaných souborù</title> <programlisting> <?php require_once ("local.php"); require_once ("../inc/global.php"); for ($i=1; $i<5; $i++) include "util".$i."php"; echo "Required_once files\n"; print_r (get_required_files()); echo "Included_once files\n"; print_r (get_included_files()); ?> </programlisting> </example> vygeneruje následující výstup: <informalexample> <programlisting> Required_once files Array ( [local] => local.php [../inc/global] => /full/path/to/inc/global.php ) Included_once files Array ( [util1] => util1.php [util2] => util2.php [util3] => util3.php [util4] => util4.php ) </programlisting> </informalexample> </para> <para> <note> <para> Od verze PHP 4.0.1pl2 tato funkce pøedpokládá, e soubory v <varname>required_once</varname> konèí pøíponou ".php", jiné pøípony nefungují. </para> </note> </para> <para> Viz také: <function>require_once</function>, <function>include_once</function>, <function>get_included_files</function> </para> </refsect1> </refentry> <refentry id="function.get-included-files"> <refnamediv> <refname>get_included_files</refname> <refpurpose> Vrátit pole jmen vech souborù, které byly ve skriptu naèteny pomocí include_once() </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_included_files</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí asociativní pole jmen vech souborù, které byly naèteny do skriptu pomocí <function>include_once</function>. Indexy tohoto pole jsou názvy souborù pouitých v <function>include_once</function> bez pøípony ".php". </para> <para> <note> <para> Od verze PHP 4.0.1pl2 tato funkce pøedpokládá, e soubory v <varname>include_once</varname> konèí pøíponou ".php", jiné pøípony nefungují. </para> </note> </para> <para> Viz také: <function>require_once</function>, <function>include_once</function>, <function>get_required_files</function> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/mail.xml +++ phpdoc/cs/functions/mail.xml <reference id="ref.mail"> <title>Mail functions</title> <titleabbrev>Mail</titleabbrev> <partintro> <simpara> The <function>mail</function> function allows you to send mail.</simpara> </partintro> <refentry id="function.mail"> <refnamediv> <refname>mail</refname> <refpurpose>send mail</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>bool <function>mail</function></funcdef> <paramdef>string <parameter>to</parameter></paramdef> <paramdef>string <parameter>subject</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> <paramdef>string <parameter><optional>additional_headers</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Mail</function> automaticky odmailuje vzkaz specifikovaný v <parameter>message</parameter> pøíjemci specifikovanému v <parameter>to</parameter>. Pøidáním èárky mezi adresami v <parameter>to</parameter> mùete specifikovat více pøíjemcù. </simpara> <para> <example> <title>Odeslání mailu.</title> <programlisting> mail("rasmus@lerdorf.on.ca", "Mùj pøedmìt", "Øádek 1\nØádek 2\nØádek 3"); </programlisting> </example></para> <simpara> Pokud je pøedán ètvrtý argument, jeho hodnota se vloí na konec hlavièek. Toto se obvykle pouívá k pøidání extra hlavièek. If a fourth string argument is passed, this string is inserted at the end of the header. This is typically used to add extra headers. Vícenásobné hlavièky se oddìlují zaøádkováním.</simpara> <para> <example> <title>Odeslání mailu s extra hlavièkami.</title> <programlisting> mail("nobody@aol.com", "pøedmìt", $message, "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion()); </programlisting> </example> K vytvoøení komplexních emailù mùete také pouít pomìrnì jednoduché techniky pro tvorbu øetìzcù. <example> <title>Sending complex email.</title> <programlisting> /* recipients */ $recipient .= "Mary <mary@u.college.edu>" . ", " ; //vimnìte si èárky $recipient .= "Kelly <kelly@u.college.edu> . ", "; $recipient .= "ronabop@php.net"; /* subject */ $subject = "Birthday Reminders for August"; /* message */ $message .= "Následující email obsahuje formátovanou ASCII tabulku\n"; $message .= "Day \t\tMonth \t\tYear\n"; $message .= "3rd \t\tAug \t\t1970\n"; $message .= "17rd\t\tAug \t\t1973\n"; /* mùete pøidat signaturu */ $message .= "--\r\n"; //oddìlovaè signatury $message .= "Birthday reminder copylefted by public domain"; /* dodateèné hlavièky pro chyby, From, cc, bcc, atd */ $headers .= "From: Birthday Reminder <birthday@php.net>\n"; $headers .= "X-Sender: <birthday@php.net>\n"; $headers .= "X-Mailer: PHP\n"; // mailový klient $headers .= "X-Priority: 1\n"; // Urgentní vzkaz! $headers .= "Return-Path: <birthday@php.net>\n"; // Návratová cesta pro chyby /* Pokud chcete poslat HTML email, odkomentujte následující øádek */ // $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime typ $headers .= "cc:birthdayarchive@php.net\n"; // CC $headers .= "bcc:birthdaycheck@php.net, birthdaygifts@php.net\n"; // BCC /* a teï to odeleme */ mail($recipient, $subject, $message, $headers); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.ezmlm-hash"> <refnamediv> <refname>ezmlm_hash</refname> <refpurpose>Poèítá hash hodnotu potøebnou pro EZMLM</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ezmlm_hash</function></funcdef> <paramdef>string <parameter>addr</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>ezmlm_hash</function> Poèítá hash hodnotu, která je potøeba pro uchovávání EZMLM mailing listù v MySQL databázi. </simpara> <para> <example> <title>Výpoèet hashe a pøihláení uivatele</title> <programlisting> $user = "kris@koehntopp.de"; $hash = ezmlm_hash ($user); $query = sprintf ("INSERT INTO sample VALUES (%s, '%s')", $hash, $user); $db->query($query); // pouito databázové rozhraní PHPLIB </programlisting> </example> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/misc.xml +++ phpdoc/cs/functions/misc.xml <reference id="ref.misc"> <title>Smíené funkce</title> <titleabbrev>Smíené</titleabbrev> <partintro> <para> Tyto funkce byly umístìny zde, protoe nespadají do ádné jiné kategorie. </para> </partintro> <refentry id="function.connection-aborted"> <refnamediv> <refname>connection_aborted</refname> <refpurpose>Vrací true, pokud se klient odpojil</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>connection_aborted</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrátí true, pokud se klient odpojil. Úplné vysvìtlení viz popis v <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link>. </simpara> </refsect1> </refentry> <refentry id="function.connection-status"> <refnamediv> <refname>connection_status</refname> <refpurpose>Vrací bitové pole stavu spojení</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>connection_status</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vrací bitové pole stavu spojení. Úplné vysvìtlení viz popis v <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link>. </simpara> </refsect1> </refentry> <refentry id="function.connection-timeout"> <refnamediv> <refname>connection_timeout</refname> <refpurpose>Return true if script timed out</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>connection_timeout</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns true if script timed out. Úplné vysvìtlení viz popis v <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link>. </simpara> </refsect1> </refentry> <refentry id="function.define"> <refnamediv> <refname>define</refname> <refpurpose>Definuje pojmenovanou konstantu.</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>define</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> <paramdef>mixed <parameter>value</parameter></paramdef> <paramdef>int <parameter><optional>case_insensitive</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Definuje pojmenovanou konstantu, která je podobná promìnné s výjimkou toho, e: <itemizedlist> <listitem> <simpara> Konstanty nemají znak dolaru ('$') pøed jménem; </simpara> </listitem> <listitem> <simpara> Konstanty jsou dostupné odkudkoliv bez ohledu na pravidla rozsahu platnosti promìnných; </simpara> </listitem> <listitem> <simpara> Konstanty se nedají pøedefinovávat a ruit; a </simpara> </listitem> <listitem> <simpara> Konstanty se mohou nabývat pouze skalárních hodnot. </simpara> </listitem> </itemizedlist> </para> <para> Název konstanty je dán argumentem <parameter>name</parameter>; hodnota je dána argumentem <parameter>value</parameter>. </para> <para> Dále je dostupný volitelní tøetí argument <parameter>case_insensitive</parameter>. Pokud má hodnotu <emphasis>1</emphasis>, konstanta bude definována case-insensitive. Výchozí chování je case-sensitive; tj. CONSTANT and Constant reprezentují rùzné hodnoty. </para> <para> <example> <title>Definování konstant</title> <programlisting role="php"> <?php define ("CONSTANT", "Hello world."); echo CONSTANT; // výstup je "Hello world." ?> </programlisting> </example> </para> <para> <function>Define</function> vrací TRUE pøi úspìchu a FALSE pokud dojde k chybì. </para> <para> Viz také <function>defined</function> a sekci <link linkend="language.constants">Konstanty</link>. </para> </refsect1> </refentry> <refentry id="function.defined"> <refnamediv> <refname>defined</refname> <refpurpose> Zkontroluje, jestli existuje daná pojmenovaná konstanta </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>defined</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrací true, pokud byla definována pojmenovaná konstanta daná argumentem <parameter>name</parameter>, jinak false. <example> <title>Kontrola konstant</title> <programlisting role="php"> <?php if (defined("CONSTANT")){ // název konstanty by mìl být v uvozovkách echo CONSTANT; // } ?> </programlisting> </example> </para> <para> Viz také <function>define</function> a sekci <link linkend="language.constants">Konstanty</link>. </para> </refsect1> </refentry> <refentry id="function.die"> <refnamediv> <refname>die</refname> <refpurpose> Vytiskne vzkaz a ukonèí souèasný skript </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>die</function></funcdef> <paramdef>string <parameter>message</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Tento jazykový konstrukt vytiskne vzkaz a ukonèí parsování skriptu. Nemá návratovou hodnotu. </simpara> <para> <example> <title>die example</title> <programlisting role="php"> <?php $filename = '/path/to/data-file'; $file = fopen ($filename, 'r') or die("nepodaøilo se otevøít soubor ($filename)"); ?> </programlisting> </example> </para> <simpara> Viz také <function>exit</function>. </simpara> </refsect1> </refentry> <refentry id="function.eval"> <refnamediv> <refname>eval</refname> <refpurpose>Vyhodnotí øetìzec jako PHP kód</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>eval</function></funcdef> <paramdef>string <parameter>code_str</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>eval</function> vyhodnotí øetìzec pøedaný v <parameter>code_str</parameter> jako PHP kód. Kromì jiného se dá vyuít na ukládání kódu v textovém sloupci databáze pro pozdìjí vykonání. </simpara> <simpara> Pøi pouívání <function>eval</function> byste mìli mít na pamìti nìkolik faktorù. Pamatujte si, e pøedávaný øetìzec musí být platný PHP kód, vèetnì vìcí jako ukonèování výrazù støedníkem, aby parser nezemøel na øádku po <function>eval</function>, a øádné escapování v <parameter>code_str</parameter>. </simpara> <simpara> Také pamatujte, ze hodnoty pøiøazené promìnným v <function>eval</function> tìmto promìnným zùstanou i v hlavním skriptu. </simpara> <simpara> Výraz <literal>return</literal> okamitì ukonèí vyhodnocování pøedaného øetìzce. V PHP 4 mùete pouít <literal>return</literal> k vrácení hodnoty, která se stane výsledkem <function>eval</function> funkce, zatímco v PHP 3 byl <function>eval</function> typu <literal>void</literal> nic nevracel. </simpara> <para> <example> <title> <function>Eval</function> pøíklad - jednoduché spojení textù </title> <programlisting role="php"> <?php $string = 'cup'; $name = 'coffee'; $str = 'This is a $string with my $name in it.<br>'; echo $str; eval ("\$str = \"$str\";"); echo $str; ?> </programlisting> </example> </para> <para> Výe uvedený pøíklad ukáe: <programlisting> This is a $string with my $name in it. This is a cup with my coffee in it. </programlisting> </para> </refsect1> </refentry> <refentry id="function.exit"> <refnamediv> <refname>exit</refname> <refpurpose>Ukonèí souèasný skript</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>exit</function></funcdef> <void/> </funcprototype> </funcsynopsis> <simpara> Tento jazykový konstrkut ukonèí parsování skriptu. Nevrací ádnou hodnotu. </simpara> <simpara> Viz také <function>die</function>. </simpara> </refsect1> </refentry> <refentry id="function.get-browser"> <refnamediv> <refname>get_browser</refname> <refpurpose> Urèuje schopnosti uivatelova browseru </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>object <function>get_browser</function></funcdef> <paramdef>string <parameter><optional>user_agent</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> <function>get_browser</function> se pokusí urèit schopnosti uivatelova browseru. Toho je dosaeno vyhledáním informací o browseru v souboru <filename>browscap.ini</filename>. Standardne se pouije $HTTP_USER_AGENT; nicménì, mùete to zmìnit (tj. vyhledat informace o jiném browseru) pøedáním volitelného argumentu <parameter>user_agent</parameter>. </simpara> <simpara> Informace se vracejí jako objekt, který obsahuje rùzné datové elementy, které reprezentují napøíklad hlavní a vedlejí èíslo verze a ID øetìzec; true/false hodnoty vlastností jako podpora rámcù, JavaScript a cookies, atd. </simpara> <simpara> Jakkoli <filename>browscap.ini</filename> obsahuje informace o mnoha browserech, aktuálnost databáze závisí na uivatelských updatech. Formát souboru je pomìrnì snadno pochopitelný. </simpara> <para> Následující pøíklad ukazuje, jak by se daly vypsat vechny informace získané o uivatelovì browseru. <example> <title><function>Get_browser</function> pøíklad</title> <programlisting role="php"> <?php function list_array ($array) { while (list ($key, $value) = each ($array)) { $str .= "<b>$key:</b> $value<br>\n"; } return $str; } echo "$HTTP_USER_AGENT<hr>\n"; $browser = get_browser(); echo list_array ((array) $browser); ?> </programlisting> </example> </para> <simpara> Výstup z výe uvedeného skriptu by vypadal asi takto: </simpara> <programlisting> Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr> <b>browser_name_pattern:</b> Mozilla/4\.5.*<br> <b>parent:</b> Netscape 4.0<br> <b>platform:</b> Unknown<br> <b>majorver:</b> 4<br> <b>minorver:</b> 5<br> <b>browser:</b> Netscape<br> <b>version:</b> 4<br> <b>frames:</b> 1<br> <b>tables:</b> 1<br> <b>cookies:</b> 1<br> <b>backgroundsounds:</b> <br> <b>vbscript:</b> <br> <b>javascript:</b> 1<br> <b>javaapplets:</b> 1<br> <b>activexcontrols:</b> <br> <b>beta:</b> <br> <b>crawler:</b> <br> <b>authenticodeupdate:</b> <br> <b>msn:</b> <br> </programlisting> <simpara> Aby to fungovalo, <link linkend="ini.sect.browscap">browscap</link> direktiva ve vaem konfiguraèním souboru musí ukazovat na platné umístìní <filename>browscap.ini</filename> souboru. </simpara> <simpara> Pro dalí informace (vèetnì lokací na kterých mùete získat <filename>browscap.ini</filename> soubor) viz PHP FAQ na <ulink url="&url.php.faq;">&url.php.faq;</ulink>. </simpara> </refsect1> </refentry> <refentry id="function.highlight-file"> <refnamediv> <refname>highlight_file</refname> <refpurpose>Zvýrazní syntaxi souboru</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>highlight_file</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>highlight_file</function> vytiskne barevnì zvýraznìnou syntaxi kódu obsaeného ve <parameter>filename</parameter> s pouitím barev definovaných ve zvýrazòovaèi syntaxe zabudovaném v PHP. Vrací true pøi úspìchu, jinak false (PHP 4). </simpara> <para> <example> <title>Tvorba URL zvyrazòující syntaxi</title> <simpara> K vytvoøení URL, která zvýrazní syntaxi jakéhokoliv skriptu, který jí pøedáte vyuijeme "ForceType" direktivu Apache k vytvoøení hezkého vzorce URL, and pomocí funkce <function>highlight_file</function> vypíeme hezky vypadající výpis kódu. </simpara> <simpara> Do svého httpd.conf pøidejte následující: </simpara> <para> <informalexample><programlisting> <Location /source> ForceType application/x-httpd-php </Location> </programlisting></informalexample> </para> <simpara> A potom vytvoøte soubor pojmenovaný "source", a umístìte ho do svého web root adresáøe. </simpara> <para> <programlisting role="php"> <HTML> <HEAD> <TITLE>Zobrazení zdroje</TITLE> </HEAD> <BODY BGCOLOR="white"> <?php $script = getenv ("PATH_TRANSLATED"); if(!$script) { echo "<BR><B>CHYBA: Je potøeba název skriptu!</B><BR>"; } else { if (ereg("(\.php|\.inc)$",$script)) { echo "<H1>Zdroj souboru: $PATH_INFO</H1>\n<HR>\n"; highlight_file($script); } else { echo "<H1>CHYBA: Povoleny jsou pouze soubory s pøíponou .php nebo .inc!</H1>"; } } echo "<HR>Zpracováno: ".date("Y/M/d H:i:s",time()); ?> </BODY> </HTML> </programlisting> </para> <simpara> Potom mùete pouít URL jako je ta níe k zobrazení obarvené verze skriptu umístìné v "/path/to/script.php" na vaem webu. </simpara> <para> <informalexample> <programlisting> http://your.server.com/source/path/to/script.php </programlisting> </informalexample> </para> </example> </para> <simpara> Viz také <function>highlight_string</function>, <function>show_source</function>. </simpara> </refsect1> </refentry> <refentry id="function.highlight-string"> <refnamediv> <refname>highlight_string</refname> <refpurpose>Zvýraznìní syntaxe øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>highlight_string</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>highlight_string</function> vytiskne barevnì zvýraznìnou verzi <parameter>str</parameter> s pouitím barev definovaných ve zvýrazòovaèi syntaxe zabudovaném v PHP. Vrací true pøi úspìchu, jinak false (PHP 4). </simpara> <simpara> Viz také <function>highlight_file</function>, <function>show_source</function>. </simpara> </refsect1> </refentry> <refentry id="function.ignore-user-abort"> <refnamediv> <refname>ignore_user_abort</refname> <refpurpose> Nastavuje, jestli má ukonèení spojení klientem pøeruit vykonávání skriptu </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ignore_user_abort</function></funcdef> <paramdef>int <parameter><optional>setting</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> Tato funkce nastavuje, jestli má odpojení klienta zpùsobit ukonèení skriptu. Vrací pøedchozí nastavení, a pøi zavolání bez argumentu souèasné nastavení nemìní, pouze ho vrací. Úplné vysvìtlení viz popis v sekci <link linkend="features.connection-handling">Obsluha spojení</link> v kapitole <link linkend="features">Vlastnosti</link> </simpara> </refsect1> </refentry> <refentry id="function.iptcparse"> <refnamediv> <refname>iptcparse</refname> <refpurpose> Parsuje binární IPTC <ulink url="&url.iptc;">&url.iptc;</ulink> blok do jednotlivých tagù. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>iptcparse</function></funcdef> <paramdef>string <parameter>iptcblock</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Tato funkce parsuje binární IPTC blok do jeho jednotlivých tagù. Vrací pole, které pouívá tagmarker jako index, a jeho hodnotu jako hodnotu. Vrací false pøi chybì, nebo pokud nenajde ádná IPTC data. Pøíklad viz <function>GetImageSize</function>. </simpara> </refsect1> </refentry> <refentry id="function.leak"> <refnamediv> <refname>leak</refname> <refpurpose>Nenávratnì alokuje pamìt</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>leak</function></funcdef> <paramdef>int <parameter>bytes</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Leak</function> nenávratnì alokuje specifikované mnoství pamìti. </simpara> <simpara> Tato funkce je uiteèná pøi ladìní správce pamìti, který automaticky èistí "vyteklou" (leaked) pamìt pøi dokonèení kadého poadavku. </simpara> </refsect1> </refentry> <refentry id="function.pack"> <refnamediv> <refname>pack</refname> <refpurpose>Sbalí data do binárního øetìzce.</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>pack</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed <parameter><optional>args</optional></parameter> ... </paramdef> </funcprototype> </funcsynopsis> <para> Sbalí pøedané argumenty do binárního øetìzce podle argumentu <parameter>format</parameter>. Vrací binární øetìzec obsahující pøedaná data. </para> <para> Nápad na tuto funkci byl pøevzat z Perlu, a vechny formátovací kódy fungují stejnì jako tam, nicménì, nìkteré formátovací kódy chybí, jako napøíklad Perlovský formátovací kód "u". Formátovací øetìzec sestává z formátovacích kódu následovaných volitelným opakovacím argumentem. Opakovací argument mùe být buï celoèíselná hodnota, nebo * pro opakování do konce vstupních dat. U a, A, h, H poèet opakování urèuje, kolik znakù se vezme z jednoho datového argumentu, u @ je to absolutní pozice, kde se mají umístit dalí data, u veho ostatního poèet opakování urèuje, kolik datových argumentù se spotøebuje a sbalí do výsledného binárního øetìzce. V souèasnosti jsou implementovány <itemizedlist> <listitem> <simpara> a øetìzec doplnìný NUL hodnotami </simpara> </listitem> <listitem> <simpara> A øetìzec doplnìný SPACE hodnotami </simpara> </listitem> <listitem> <simpara> h Hex øetìzec, spodní slabika první </simpara> </listitem> <listitem> <simpara> H Hex øetìzec, horní slabika první </simpara> </listitem> <listitem> <simpara> c signed char </simpara> </listitem> <listitem> <simpara> C unsigned char </simpara> </listitem> <listitem> <simpara> s signed short (vdy 16 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> S unsigned short (vdy 16 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> n unsigned short (vdy 16 bitù, big endian byte order) </simpara> </listitem> <listitem> <simpara> v unsigned short (vdy 16 bitù, little endian byte order) </simpara> </listitem> <listitem> <simpara> i signed integer (velikost a poøadí bytù závislá na systému) </simpara> </listitem> <listitem> <simpara> I unsigned integer (velikost a poøadí bytù závislá na systému) </simpara> </listitem> <listitem> <simpara> l signed long (vdy 32 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> L unsigned long (vdy 32 bitù, machine byte order) </simpara> </listitem> <listitem> <simpara> N unsigned long (vdy 32 bitù, big endian byte order) </simpara> </listitem> <listitem> <simpara> V unsigned long (vdy 32 bitù, little endian byte order) </simpara> </listitem> <listitem> <simpara> f float (velikost a reprezentace závislá na systému) </simpara> </listitem> <listitem> <simpara> d double (velikost a reprezentace závislá na systému) </simpara> </listitem> <listitem> <simpara> x NUL byte </simpara> </listitem> <listitem> <simpara> X Back up one byte </simpara> </listitem> <listitem> <simpara> @ NUL-fill to absolute position </simpara> </listitem> </itemizedlist> <example> <title><function>Pack</function> formátovací øetìzec</title> <programlisting role="php"> $binarydata = pack ("nvc*", 0x1234, 0x5678, 65, 66); </programlisting> <para> Výsledný binární øetìzec bude 6 bytù dlouhý, a bude obsahovat bytovou sekvenci 0x12, 0x34, 0x78, 0x56, 0x41, 0x42. </para> </example> </para> <para> Vimnìte si, e rozdíl mezi hodnotami se znaménkem a bez znaménka ovlivòuje pouze funkci <function>unpack</function>, zatímco funkce <function>pack</function> dává stejný výsledek pro formátovací kódy se znaménkem i bez znaménka. </para> <para> Dále si vimnìte, e PHP internì ukládá celoèíselné hodnoty jako hodnoty se znaménkem o velikosti závislé na systému. Pokud zadáte hodnotu bez znaménka, která bude pøíli velká, ne aby se dala takto uloit, pøevede se na double, co èasto vytváøí neádoucí výsledky. </para> </refsect1> </refentry> <refentry id="function.show-source"> <refnamediv> <refname>show_source</refname> <refpurpose>Zvýrazní syntaxi souboru</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>show_source</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>show_source</function> vytiskne barevnì zvýraznìnou syntaxi kódu obsaeného ve <parameter>filename</parameter> s pouitím barev definovaných ve zvýrazòovaèi syntaxe zabudovaném v PHP. Vrací true pøi úspìchu, jinak false (PHP 4). </simpara> <note> <simpara> Tato funkce je alias funkce <function>highlight_file</function> </simpara> </note> <simpara> Viz také <function>highlight_string</function>, <function>highlight_file</function>. </simpara> </refsect1> </refentry> <refentry id="function.sleep"> <refnamediv> <refname>sleep</refname> <refpurpose>Odloí provedení</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>sleep</function></funcdef> <paramdef>int <parameter>seconds</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce sleep odkládá provedení programu o poèet sekund pøedaný v argumentu <parameter>seconds</parameter>. </simpara> <simpara> Viz také <function>usleep</function>. </simpara> </refsect1> </refentry> <refentry id="function.uniqid"> <refnamediv> <refname>uniqid</refname> <refpurpose>Generatuje unikátní id</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>uniqid</function></funcdef> <paramdef>string <parameter>prefix</parameter></paramdef> <paramdef>boolean <parameter><optional>lcg</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> <function>Uniqid</function> vrací unikátní identifikátor zaloený na souèasném èase v mikrosekundách, opatøený prefixem. Prefix mùe být uiteèný napøíklad pokud generujete identifikátory na nìkolika serverech souèasnì, které by mohly vygenerovat identifikátor ve stejnou mikrosekundu. <parameter>Prefix</parameter> mùe být a 114 znakù dlouhý. </simpara> <simpara> Pokud je volitelný argument <parameter>lcg</parameter> true, <function>uniqid</function> pøidá dodateènou "kombinovanou LCG" entropii na konec své návratové hodnoty, co by mìlo uèinit výsledky jetì unikátnìjími. </simpara> <simpara> Pokud je <parameter>prefix</parameter> prázdný, vrácený øetìec bude 13 znakù dlouhý. Pokud je <parameter>lcg</parameter> true, bude dlouhý 23 znakù. </simpara> <note> <simpara> <parameter>lcg</parameter> argument je pøístupný pouze v PHP 4 and PHP 3.0.13 a vyích. </simpara> </note> <para> Pokud potøebujete unikátní identifikátor nebo symbol, a zamýlíte pøedat tento symbol uivateli po síti (napø. session cookies), doporuèujeme pouít nìco jako <informalexample> <programlisting role="php"> $token = md5 (uniqid ("")); // no random portion $better_token = md5 (uniqid (rand())); // better, difficult to guess </programlisting> </informalexample> </para> <simpara> Toto vytvoøí 32znakový identifikátor (128bitové hexa èíslo), které se extrémnì teko pøedpovídá. </simpara> </refsect1> </refentry> <refentry id="function.unpack"> <refnamediv> <refname>unpack</refname> <refpurpose>Rozbalí data z binárního øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>unpack</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>string <parameter>data</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Unpack</function> rozbalí data z binárního øetìzce do pole podle <parameter>format</parameter>. Vrací pole obsahující rozbalené prvky binárního øetìzce. </para> <para> <function>Unpack</function> funguje trochu jinak ne v Perlu, jeliko rozbalená data jsou uloena v asociativním poli. Toho dosáhnete tak, e vyjmenujete rùzné formátovací kódy a oddìlíte je lomítkem /. <example> <title><function>Unpack</function> format string</title> <programlisting role="php"> $array = unpack ("c2chars/nint", $binarydata); </programlisting> <para> Výsledné pole obsahuej poloky "chars1", "chars2" and "int". </para> </example> </para> <para> Vysvìtlení formátovacích kódù viz také: <function>pack</function> </para> <para> Vimnìte si, e PHP internì ukládá celoèíselné hodnoty se znaménkem. Pokud rozbalíte velkou celoèíselnou hodnotu bez znaménka a ta má stejnou velikost jako hodnoty internì ukládané PHP, výsledkem bude negativní èíslo, i kdy bylo zadáno rozbalování bez znaménka. </para> </refsect1> </refentry> <refentry id="function.usleep"> <refnamediv> <refname>usleep</refname> <refpurpose>Odloí provedení v mikrosekundách</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>usleep</function></funcdef> <paramdef>int <parameter>micro_seconds</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>usleep</function> odloí provedení skriptu o daný poèet <parameter>micro_seconds</parameter>. </simpara> <simpara> Viz také <function>sleep</function>. </simpara> <note> <simpara> Tato funkce nefunguje na Windows systémech. </simpara> </note> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/readline.xml +++ phpdoc/cs/functions/readline.xml <reference id="ref.readline"> <title>GNU Readline</title> <titleabbrev>Readline</titleabbrev> <partintro> <simpara> <function>readline</function> funkce implementují rozhraní ke GNU Readline knihovnì. Tyto funkce poskytují editovatelné pøíkazové øádky. Pøíkladem mùe být zpùsob, jakým vám Bash umoòuje vkládat znaky nebo listovat historií pøíkazù pomocí kláves pro pohyb kurzoru. Z interaktivní povahy této knihovny vyplývá, e není pøíli uiteèná pro psaní webových aplikací, ale mùe být uiteèná pøi psaní skriptù, které se mají spoutìt z pøíkazové øádky. </simpara> <simpara> Domovskou stránkou GNU Readline projektu je <ulink url="&url.readline;">&url.readline;</ulink>. Udruje jej Chet Ramey, který je také autorem Bashe. </simpara> </partintro> <refentry id="function.readline"> <refnamediv> <refname>readline</refname> <refpurpose>Pøeèíst øádek</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>readline</function></funcdef> <paramdef>string <parameter><optional>prompt</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí jeden øádek od uivatele. Mùete specifikovat øetìzec, který se má uivateli zobrazit jako výzva. Z vráceného øádku je odstranìna sekvence konce øádku. Do historie tento øádek musíte pøidat sami pomocí <function>readline_add_history</function>. </para> <example> <title><function>Readline</function></title> <programlisting role="php"> //ziska 3 prikazy uzivatele for ($i=0; $i < 3; $i++) { $line = readline ("Command: "); readline_add_history ($line); } //vypise historii print_r (readline_list_history()); //vypise promenne print_r (readline_info()); </programlisting> </example> </refsect1> </refentry> <refentry id="function.readline-add-history"> <refnamediv> <refname>readline_add_history</refname> <refpurpose>Pøidat øádek do historie</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>readline_add_history</function></funcdef> <paramdef>string <parameter>line</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce pøidá øádek do historie pøíkazové øádky.</para> </refsect1> </refentry> <refentry id="function.readline-clear-history"> <refnamediv> <refname>readline_clear_history</refname> <refpurpose>Smazat historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_clear_history</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce smae celou historii pøíkazové øádky.</para> </refsect1> </refentry> <refentry id="function.readline-completion-function"> <refnamediv> <refname>readline_completion_function</refname> <refpurpose>Zaregistrovat dokonèující funkci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_completion_function</function> </funcdef> <paramdef>string <parameter>line</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce zaregistruje dokonèující funkci. Musíte zadat název existující funkce, která pøijímá èásteèný pøíkaz a vrací pole moných protìjkù. Toto je stejná funkcionalita jakou dostanete, pokud v Bashi zmáèknete klávesu tab. </para> </refsect1> </refentry> <refentry id="function.readline-info"> <refnamediv> <refname>readline_info</refname> <refpurpose>Zjistit/nastavit rùzné interní promìnné readline</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>readline_info</function></funcdef> <paramdef>string <parameter><optional>varname</optional></parameter> </paramdef> <paramdef>string <parameter><optional>newvalue</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Pøi volání bez argumentù tato funkce vrátí pole hodnot pro vechna nastavení, která readline pouívá. Prvky jsou indexovány podle následujících hodnot: done, end, erase_empty_line, library_version, line_buffer, mark, pending_input, point, prompt, readline_name a terminal_name. </para> <para> Pøi volání s jedním argumentem vrátí hodnotu tohoto nastavení. Pøi volání se dvìma argumenty se nastavení zmení na danou hodnotu. </para> </refsect1> </refentry> <refentry id="function.readline-list-history"> <refnamediv> <refname>readline_list_history</refname> <refpurpose>Vypsat historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>readline_list_history</function></funcdef> <paramdef>void <parameter></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí pole celé historie pøíkazové øádky. Prvky jsou indexovány integery, poèínaje nulou. </para> </refsect1> </refentry> <refentry id="function.readline-read-history"> <refnamediv> <refname>readline_read_history</refname> <refpurpose>Vrátit historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_read_history</function> </funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce pøeète historii pøíkazové øádky ze souboru.</para> </refsect1> </refentry> <refentry id="function.readline-write-history"> <refnamediv> <refname>readline_write_history</refname> <refpurpose>Zapsat historii</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>readline_write_history</function> </funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para>Tato funkce zapíe historii pøíkazové øádky do souboru.</para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/recode.xml +++ phpdoc/cs/functions/recode.xml <reference id="ref.recode"> <title>GNU Recode funkce</title> <titleabbrev>Recode</titleabbrev> <partintro> <para> Tento modul obsahuje rozhraní ke GNU Recode knihovnì, verze 3.5. Pokud cchete pouívat funkce definované v tomto modulu, musíte zkompilovat vá PHP interpretr s --with-recode. K tomu potøebujete mít na svém systému nainstalovanou GNU Recode 3.5 nebo vyí. </para> <para> GNU Recode knihovna konvertuje soubory mezi rùznými znakovými sadami a kódováními. Kdy nelze dosáhnout pøesné konverze, mùe se uchýlit k approximacím. Tato knihovna rozeznává nebo produkuje témìø 150 rùzných znakových sad, a je schopná konvertovat soubory mezi témìø libovolným párem. Podporuje vìtinu znakových sad z RFC 1345. </para> </partintro> <refentry id="function.recode-string"> <refnamediv> <refname>recode_string</refname> <refpurpose>Pøekóduje øetìzec podle poadavku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>recode_string</function></funcdef> <paramdef>string <parameter>request</parameter></paramdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pøekóduje øetìzec <parameter>string</parameter> podle poadavku <parameter>request</parameter>. Vrací pøekódovaný øetìzec nebo FALSE, pokud nebylo moné provést poadavek na pøekódování. </para> <para> Jednoduchý poadavek na pøekódování mùe být "lat1..iso646-de". Detailní instrukce k poadavkùm viz GNU Recode dokumentaci u vaí instalace. <example> <title>Základní <function>recode_string</function> pøíklad:</title> <programlisting role="php"> print recode_string ("us..flat", "Následující znak má diakritické znaménko: &aacute;"); </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.recode"> <refnamediv> <refname>recode</refname> <refpurpose>Pøekóduje øetìzec podle poadavku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>recode_string</function></funcdef> <paramdef>string <parameter>request</parameter></paramdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <note> <simpara> Toto je alias k <function>recode_string</function>. Byl pøidán v PHP 4. </simpara> </note> </refsect1> </refentry> <refentry id="function.recode-file"> <refnamediv> <refname>recode_file</refname> <refpurpose> Pøekóduje soubor na soubor podle poadavku </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>recode_file</function></funcdef> <paramdef>string <parameter>request</parameter></paramdef> <paramdef>resource <parameter>input</parameter></paramdef> <paramdef>resource <parameter>output</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Pøekóduje soubor odkazovaný deskriptorem <parameter>input</parameter> do souboru odkazovaném deskriptorem <parameter>output</parameter> podle poadavku <parameter>request</parameter>. Pokud se nepodaøilo poadavek provést, vrací FALSE, jinak TRUE. </para> <para> Tato funkce v souèasnosti nezpracovává deskriptory odkazující na vzdálené soubory (URL). Oba deskriptory musí ukazovat na místní soubory. </para> <para> <example> <title>Základní pøíklad <function>recode_file</function></title> <programlisting role="php"> $input = fopen ('input.txt', 'r'); $output = fopen ('output.txt', 'w'); recode_file ("us..flat", $input, $output); </programlisting> </example> </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/strings.xml +++ phpdoc/cs/functions/strings.xml <reference id="ref.strings"> <title>Funkce pro práci s øetìzci</title> <titleabbrev>Øetìzce</titleabbrev> <partintro> <simpara> Vechny tyto funkce rùznými zpùsoby pracují s øetìzci. Nìkteré specializovanìjí funkce najdete v sekcích regulárních výrazù a manipulace s URL. </simpara> <para> Informace o chování øetìzcù, zvlátì v souvislosti s pouitím jednoduchých uvozovek, dvojitých uvozovek a escape sekvencí viz poloku <link linkend="language.types.string">Øetìzce</link> v sekci <link linkend="language.types">Typy</link> tohoto manuálu. </para> </partintro> <refentry id="function.addcslashes"> <refnamediv> <refname>AddCSlashes</refname> <refpurpose>Opatøit øetìzec lomítky ve stylu jazyka C</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>addcslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>charlist</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec se zpìtnými lomítky pøed znaky, které jsou vypsány v argumentu <parameter>charlist</parameter>. XXX Excapes <literal>\n</literal>, <literal>\r</literal> atd. podobnì jako v C, znaky s ASCII kódem niím ne 32 a vyím ne 126 se pøevedou na osmièkovou reprezentaci. V <parameter>charlist</parameter> mùete udat rozsah, napø. "\0..\37", co by XXX escapovao vechny znaky s ASCII kódem mezi 0 a 31. <example> <title>Ukázka <function>Addcslashes</function></title> <programlisting role="php"> $escaped = addcslashes ($not_escaped, "\0..\37!@\177..\377"); </programlisting> </example> <note> <simpara> Pøidáno v PHP4b3-dev.</simpara> </note> </para> <para> Viz také <function>stripcslashes</function>, <function>stripslashes</function>, <function>htmlspecialchars</function>, <function>htmlspecialchars</function> a <function>quotemeta</function>. </para> </refsect1> </refentry> <refentry id="function.addslashes"> <refnamediv> <refname>AddSlashes</refname> <refpurpose>Opatøit øetìzec lomítky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>addslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec se zpìtnými lomítky pøed znaky, které potøebují XXX be quoted v databázových dotazech apod. Tyto znaky jsou jednoduchá uvozovka (<literal>'</literal>), dvojitá uvozovka (<literal>"</literal>), zpìtné lomítko (<literal>\</literal>) a NUL (null byte). </para> <para> Viz také <function>stripslashes</function>, <function>htmlspecialchars</function> a <function>quotemeta</function>. </para> </refsect1> </refentry> <refentry id="function.bin2hex"> <refnamediv> <refname>bin2hex</refname> <refpurpose>Pøevést binární data na hexadecimální reprezentaci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>bin2hex</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí ASCII øetìec obsahující hexadecimální reprezentaci <parameter>str</parameter>. Konverze probíhá po bytech, horní slabika první. </para> </refsect1> </refentry> <refentry id="function.chop"> <refnamediv> <refname>Chop</refname> <refpurpose>Odstranit netisknutelné znaky z konce øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>chop</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí pøedaný øetìzec bez netisknutelných znakù (vè. koncù øádku) na konci. <example> <title>Ukázka <function>Chop</function></title> <programlisting role="php"> $trimmed = chop ($line); </programlisting> </example> </para> <note> <para> <function>chop</function> se lií do Perlovské funkce <parameter>chop()</parameter>, která z øetìzce odstraòuje poslední znak. </para> </note> <para> Viz také <function>trim</function>, <function>ltrim</function>, <function>rtrim</function>, a <function>chop</function>. </para> </refsect1> </refentry> <refentry id="function.chr"> <refnamediv> <refname>Chr</refname> <refpurpose>Vrátit urèitý znak</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>chr</function></funcdef> <paramdef>int <parameter>ascii</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec jednoho znaku obsahující znak specifikovaný argumentem <parameter>ascii</parameter>. <example> <title>Ukázka <function>Chr</function></title> <programlisting role="php"> $str .= chr (27); /* pøidá escape znak na konec $str */ /* Toto je vìtinou uiteènìjí */ $str = sprintf ("Øetìzec konèi escape znakem: %c", 27); </programlisting> </example> Tato funkce se doplòuje s funkcí <function>ord</function>. Viz také <function>sprintf</function> s formátovacím øetìzcem <literal>%c</literal>. </para> </refsect1> </refentry> <refentry id="function.chunk-split"> <refnamediv> <refname>chunk_split</refname> <refpurpose>Rozdìlit øetìzec na mení èásti</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>chunk_split</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>chunklen</optional></parameter> </paramdef> <paramdef>string <parameter><optional>end</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Dá se pouít k rozdìlení øetìzce na mení èásti, co mùe být uiteèné napø. pøi uvádìní výstupu z <link linkend="function.base64-encode">base64_encode</link> do souladu se sémantikou RFC 2045. Kadých <parameter>chunklen</parameter> (defaultnì 76) znakù vloí øetìzec <parameter>end</parameter> (defaultnì "\r\n"). Vrátí nový øetìzec, pùvodní zùstává beze zmìny. <example> <title>Ukázka <function>Chunk_split</function></title> <programlisting role="php"> # naformátuje $data s pouitím RFC 2045 sémantiky $new_string = chunk_split (base64_encode($data)); </programlisting> </example> Tato funkce je výraznì rychlejí ne <function>ereg_replace</function>. <note> <para> Tato funkce byla pøidána v 3.0.6. </para> </note> </para> </refsect1> </refentry> <refentry id="function.convert-cyr-string"> <refnamediv> <refname>convert_cyr_string</refname> <refpurpose> Pøevést z jedné znakové sady Azbuky do jiné </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>convert_cyr_string</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>from</parameter></paramdef> <paramdef>string <parameter>to</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce pøevede daný øetìzec z jedné znakové sady azbuky do jiné. Argumenty <parameter>from</parameter> a <parameter>to</parameter> jsou jednotlivé znaky, které pøedstavují zdrojovou a cílovou znakovou sadu Azbuky. Podporované typy jsou: <itemizedlist> <listitem> <simpara> k - koi8-r </simpara> </listitem> <listitem> <simpara> w - windows-1251 </simpara> </listitem> <listitem> <simpara> i - iso8859-5 </simpara> </listitem> <listitem> <simpara> a - x-cp866 </simpara> </listitem> <listitem> <simpara> d - x-cp866 </simpara> </listitem> <listitem> <simpara> m - x-mac-cyrillic </simpara> </listitem> </itemizedlist> </para> </refsect1> </refentry> <refentry id="function.count-chars"> <refnamediv> <refname>count_chars</refname> <refpurpose>Vrátit informace o znacích pouitých v øetìzci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>count_chars</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef> <parameter> <optional>mode</optional> </parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Spoèítá poèet výskytù vech byte hodnot (0..255) v <parameter>string</parameter> a vrátí je rùznými zpùsoby. Voltelný argument <parameter>Mode</parameter> má výchozí hodnotu 0. V závislosti na <parameter>mode</parameter> vrátí <function>count_chars</function> jednu z následujících moností: <itemizedlist> <listitem> <simpara> 0 - pole s klíèi tvoøenými byte hodnotami a hodnotami tvoøenými èetností kadého bytu. </simpara> </listitem> <listitem> <simpara> 1 - stejné jako 0, ale vrátí pouze byte hodnoty s èetností vyí ne nula. </simpara> </listitem> <listitem> <simpara> 2 - stejné jako 0, ale vrátí pouze byte hodnoty s èetností rovnou nule. </simpara> </listitem> <listitem> <simpara> 3 - vrátí øetìzec obsahující vechny pouité byte hodnoty. </simpara> </listitem> <listitem> <simpara> 4 - vrátí øetìzec obsahující vechny nepouité byte hodnoty. </simpara> </listitem> </itemizedlist> </para> <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </refsect1> </refentry> <refentry id="function.crc32"> <refnamediv> <refname>crc32</refname> <refpurpose>Spoèítat crc32 XXX polynomial øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>crc32</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Generuje 32bitový XXX polynomial kontrolního souètu pro <parameter>str</parameter>. Obvykle se pouívá ke kontrole integrity pøenáených dat. </para> <para> Viz také: <function>md5</function> </para> </refsect1> </refentry> <refentry id="function.crypt"> <refnamediv> <refname>crypt</refname> <refpurpose>Zaifrovat øetìzec algoritmem DES</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>crypt</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter><optional>salt</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>crypt</function> zaifruje øetìzec pomocí standardní Unixovské ifrovací metody <abbrev>DES</abbrev>. Argumenty jsou øetìzec k zaifrování a volitelný dvouznakový XXX salt, na kterém se ifrování zaloí. Více informací viz Unixovská man stránka vaí crypt funkce. </para> <simpara> Pokud není poskytnut XXX salt argument, PHP jej náhodnì vygeneruje. </simpara> <simpara> Nìkteré operaèní systémy podporují více typù ifrování. Nìkdy se standardní DES ifrování nahrazuje ifrovacím algoritmem zaloeným na MD5. Typ ifrování se zvolí podle XXX salt argumentu. Pøi instalaci PHP zjistí schopnosti funkce crypt a ??? bude pøijímat XXX salt pro jiné typy ifrování. Pøi absenci XXX salt PHP defaultnì automaticky vygeneruje standardní dvouznakový DES XXX salt, nicménì pokud je výchozím typem ifrování na daném systému MD5, vygeneruje náhodný XXX salt kompatibilní s MD5. PHP vytváøí konstantu CRYPT_SALT_LENGTH, která vám øekne, jestli se na vá systém hodí bìný dvouznakový XXX salt nebo delí dvanáctiznakový MD5 XXX salt. </simpara> <simpara> Pokud pouíváte poskytnutý XXX salt, mìli byste si být vìdomi toho, e se generuje jednou. Pokud tuto funkci voláte rekurzivnì, mùe to mít úèinek na XXX appearance, a, do urèité míry, bezpeènost. </simpara> <simpara> U standardního DES ifrování <function>crypt</function> pøidá XXX salt jako první dva znaky výstupu. </simpara> <simpara> Na systémech, kde funkce <function>crypt()</function> podporuje více typù ifrování se následující konstanty nastaví na 0 nebo 1 podle toho, jestli je daný typ dostupný: </simpara> <itemizedlist> <listitem> <simpara> CRYPT_STD_DES - Standardní DES ifrování s dvouznakovým XXX SALT </simpara> </listitem> <listitem> <simpara> CRYPT_EXT_DES - Rozíøené DES ifrování s devítiznakovým XXX SALT </simpara> </listitem> <listitem> <simpara> CRYPT_MD5 - MD5 ifrování s dvanáctiznakovým XXX SALT zaèínajícím $1$ </simpara> </listitem> <listitem> <simpara> CRYPT_BLOWFISH - Rozíøené DES ifrování s estnáctiznakovým XXX SALT zaèínajícím $2$ </simpara> </listitem> </itemizedlist> <simpara> Neexistuje ádná decrypt funkce, protoe <function>crypt</function> pouívá jednosmìrný algoritmus. </simpara> <simpara> Viz také: <function>md5</function>. </simpara> </refsect1> </refentry> <refentry id="function.echo"> <refnamediv> <refname>echo</refname> <refpurpose>Vytisknout jeden nebo více øetìzcù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef><function>echo</function></funcdef> <paramdef>string <parameter>arg1</parameter></paramdef> <paramdef>string <parameter><optional>argn</optional>...</parameter> </paramdef> </funcprototype> </funcsynopsis> <simpara> Outputs all parameters. </simpara> <para> <function>Echo</function> vlastnì není funkce (je to jazykový konstrukt), take u nìj nemusíte pouívat závorky. <example> <title>Ukázka <function>Echo</function></title> <programlisting role="php"> echo "Hello World"; echo "Toto zabírá nìkolik øádkù. Konce øádkù se vytisknou také"; echo "Toto zabírá\nnìkolik øádkù. Konce øádkù se\nvytisknou také."; </programlisting> </example> </para> <note> <para> Pokud chcete echo pøedat více argumentù, argumenty dokonce uzávorkovat nesmíte. </para> </note> <simpara> Viz také: <function>print</function>, <function>printf</function>, a <function>flush</function>. </simpara> </refsect1> </refentry> <refentry id="function.explode"> <refnamediv> <refname>explode</refname> <refpurpose>Rozdìlit øetìzec na jiném øetìzci</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>explode</function></funcdef> <paramdef>string <parameter>separator</parameter></paramdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>limit</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Vrátí pole øetìzcù, z nich kadý je èástí argumentu <parameter>string</parameter> vzniklý jeho rozdìlením na hranicích tvoøených øetìzcem <parameter>delim</parameter>. Pokud je definován <parameter>limit</parameter>, vrácené pole bude obsahovat maximálnì <parameter>limit</parameter> prvkù, a poslední prvek bude obsahovat celý zbytek <parameter>string</parameter>. </para> <note> <para> Argument <parameter>limit</parameter> byl pøidán v PHP 4.0.1 </para> </note> <para> <example> <title>Ukázka <function>Explode</function></title> <programlisting role="php"> $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode (" ", $pizza); </programlisting> </example> </para> <note> <para> I kdy <function>implode</function> mùe z historických dùvodù pøijímat argumenty v obou moných poøadích, <function>explode</function> nemùe. Musíte se ujistit, e je argument <parameter>separator</parameter> pøed argumentem <parameter>string</parameter>. </para> </note> <para> Viz také <function>split</function> a <function>implode</function>. </para> </refsect1> </refentry> <refentry id="function.get-html-translation-table"> <refnamediv> <refname>get_html_translation_table</refname> <refpurpose> Vrátit pøekladovou tabulku pouívanou v <function>htmlspecialchars</function> a <function>htmlentities</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>get_html_translation_table</function> </funcdef> <paramdef>int <parameter>table</parameter></paramdef> <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>get_html_translation_table</function> vrátí pøekladovou tabulku, která se internì pouívá ve funkcích <function>htmlspecialchars</function> a <function>htmlentities</function>. Dvì nové konstanty (<parameter>HTML_ENTITIES</parameter>, <parameter>HTML_SPECIALCHARS</parameter>) vám umoòují urèit, kterou tabulku chcete. A stejnì jako u funkcí <function>htmlspecialchars</function> a <function>htmlentities</function> mùete pøípadnì urèit <parameter>quote_style</parameter> se kterým pracujete. Výchozí hodnota je ENT_COMPAT mód. Viz popis tìchto módù u <function>htmlspecialchars</function>. <example> <title>Ukázka Translation Table</title> <programlisting role="php"> $trans = get_html_translation_table (HTML_ENTITIES); $str = "Hallo & <Frau> & Krämer"; $encoded = strtr ($str, $trans); </programlisting> </example> Promìnná <literal>$encoded</literal> teï obsahuje: "Hallo &<sgmltag>amp</sgmltag>; &<sgmltag>lt</sgmltag>;Frau&<sgmltag>gt</sgmltag>; &<sgmltag>amp</sgmltag>; Kr&<sgmltag>auml</sgmltag>;mer". </para> <para> Skvìlé je, e pomocí <function>array_flip</function> mùete zmìnit smìr pøekladu. <informalexample> <programlisting role="php"> $trans = array_flip ($trans); $original = strtr ($str, $trans); </programlisting> </informalexample> Obsahem <literal>$original</literal> je: "Hallo & <Frau> & Krämer". <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </para> <para> Viz také: <function>htmlspecialchars</function>, <function>htmlentities</function>, <function>strtr</function>, a <function>array_flip</function>. </para> </refsect1> </refentry> <refentry id="function.get-meta-tags"> <refnamediv> <refname>get_meta_tags</refname> <refpurpose> Získat hodnoty content atributù vech meta tagù v souboru a vrátit pole </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>get_meta_tags</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> <paramdef>int <parameter><optional>use_include_path</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Otevøe <parameter>filename</parameter>, pøeète ho po øádcích, a vyhledá <meta> tagy ve tvaru <example> <title>Ukázka na Meta Tagy</title> <programlisting role="html"> <meta name="author" content="name"> <meta name="tags" content="php3 documentation"> </head> <!-- tady ètení skonèí --> </programlisting> </example> (vìnujte pozornost koncùm øádkù - PHP pouívá ke ètení vstupu nativní funkci, take Macovský soubor na Unixu nebude fungovat). </para> <para> Hodnota atributu name se ve vráceném poli stává klíèem, hodnota atributu content hodnotou tohoto pole, takzè ho mùete snadno projít nebo získat jednotlivé hodnoty pomocí snandardních funkcí pro práci s poli. Zvlátní znaky v hodnotì atributu name jsou nahrazeny znakem '_', zbytek se pøevede na malá písmena. </para> <para> Pokud je <parameter>use_include_path</parameter> rovno 1, PHP se pokusí otevøít soubor ve standardní include cestì. </para> </refsect1> </refentry> <refentry id="function.hebrev"> <refnamediv> <refname>hebrev</refname> <refpurpose> Pøevést logický Hebrejský text na vizuální text </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>hebrev</function></funcdef> <paramdef>string <parameter>hebrew_text</parameter></paramdef> <paramdef>int <parameter><optional>max_chars_per_line</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Volitelný argument <parameter>max_chars_per_line</parameter> indikuje maximální poèet znakù na øádek výstupu. Funkce se snaí nerozdìlovat slova. </para> <para> Viz také <function>hebrevc</function> </para> </refsect1> </refentry> <refentry id="function.hebrevc"> <refnamediv> <refname>hebrevc</refname> <refpurpose> Pøevést logický Hebrejský text na vizuální text s konverzí koncù øádkù </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>hebrevc</function></funcdef> <paramdef>string <parameter>hebrew_text</parameter></paramdef> <paramdef>int <parameter><optional>max_chars_per_line</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce se podobá <function>hebrev</function> s tím rozdílem, e pøevádí konce øádkù (\n) na "<br>\n". Volitelný argument <parameter>max_chars_per_line</parameter> indikuje maximální poèet znakù na øádek výstupu. Funkce se snaí nerozdìlovat slova. </para> <para> Viz také <function>hebrev</function> </para> </refsect1> </refentry> <refentry id="function.htmlentities"> <refnamediv> <refname>htmlentities</refname> <refpurpose>Pøevést vechny pouitelné znaky na HTML entity</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>htmlentities</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce je ve vem shodná s <function>htmlspecialchars</function> kromì toho, e na HTML entity se pøevedou vechny znaky, které mají odpovídající entity. Stejnì jako <function>htmlspecialchars</function> pøijímá volitelný druhý argument, který indikuje, co se má stát s jednoduchými a dvojitými uvozovkami. <constant>ENT_COMPAT</constant> (výchozí) pøevede pouze dvojité uvozovky, <constant>ENT_QUOTES</constant> pøevede dvojité i jednoduché uvozovky, a <constant>ENT_NOQUOTES</constant> ponechá jednoduché i dvojité uvozovky bez konverze. </para> <para> V souèasnosti se pouívá znaková sada ISO-8859-1. Volitelný druhý argument byl pøidán v PHP 3.0.17 a PHP 4.0.3. </para> <para> Viz také <function>htmlspecialchars</function> a <function>nl2br</function>. </para> </refsect1> </refentry> <refentry id="function.htmlspecialchars"> <refnamediv> <refname>htmlspecialchars</refname> <refpurpose>Pøevést zvlátní znaky na HTML entity</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>htmlspecialchars</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Nìkteré znaky mají v HTML zvlátní význam, a pokud si mají zachovat bìný význam, mìly by být reprezentovány HTML entitami. Tato funkce vrátí øetìzec, ve kterém dolo k nìkterým z tìchto konverzí; provádìjí se ty pøeklady, které jsou v kadodenním programování pro web nejuiteènìjí. Pokud poadujete pøeklad vech znakových entit HTML, pouijte <function>htmlentities</function>. </para> <simpara> Tato funkce je uiteèná, pokud se chcete chránit pøed pøípadným výskytem HTML v textu dodaném uivateli, napøíklad u aplikací typu kniha hostù nebo diskusní skupina. Volitelný druhý argument, quote_style, urèuje, co se má stát s jednoduchými a dvojitými uvozovkami. Defaultní mód, ENT_COMPAT, je zpìtnì kompatibilní mód, konvertuje pouze dvojité uvozovky a jednoduché uvozovky ponechává nepøeloené. Pokud zadáte ENT_QUOTES, pøeloí se jednoduché i dvojité uvozovky, a pokud zadáte ENT_NOQUOTES, oba druhy zùstanou bez pøekladu. </simpara> <para> Dochází k tìmto pøekladùm: <itemizedlist> <listitem> <simpara> '&' (ampersand) se stává '&amp;' </simpara> </listitem> <listitem> <simpara> '"' (dvojitá uvozovka) se stává '&quot;' when ENT_NOQUOTES is not set. </simpara> </listitem> <listitem> <simpara> ''' (jednoduchá uvozovka) se stává '&#039;' only when ENT_QUOTES is set. </simpara> </listitem> <listitem> <simpara> '<' (mení ne) se stává '&lt;' </simpara> </listitem> <listitem> <simpara> '>' (vìtí ne) se stává '&gt;' </simpara> </listitem> </itemizedlist> <example> <title>Ukázka <function>htmlspecialchars</function></title> <programlisting role="php"> $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); </programlisting> </example> </para> <para> Poznámka: tato funkce provádí pouze výe uvedené pøeklady. Kompletní pøeklad entit viz <function>htmlentities</function>. Volitelný druhý argument byl pøidán v PHP 3.0.17 a PHP 4.0.3. </para> <para> Viz také <function>htmlentities</function> a <function>nl2br</function>. </para> </refsect1> </refentry> <refentry id="function.implode"> <refnamediv> <refname>implode</refname> <refpurpose>Spojit prvky pole pomocí øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>implode</function></funcdef> <paramdef>string <parameter>glue</parameter></paramdef> <paramdef>array <parameter>pieces</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec obsahující øetìzcovou reprezentaci vech prvkù pole v pùvodním poøadí s øetìzcem <parameter>glue</parameter> mezi kadými dvìma prvky. <example> <title>Ukázka <function>Implode</function></title> <programlisting role="php"> $colon_separated = implode (":", $array); </programlisting> </example> </para> <note> <para> <function>implode</function> mùe z historických dùvodù pøijímat argumenty v obou moných poøadích. Kvùli konzistenci s <function>explode</function> je ale asi ménì matoucí pouívat dokumentované poøadí argumentù. </para> </note> <simpara> Viz také <function>explode</function>, <function>join</function>, a <function>split</function>. </simpara> </refsect1> </refentry> <refentry id="function.join"> <refnamediv> <refname>join</refname> <refpurpose>Spojit prvky pole pomocí øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>join</function></funcdef> <paramdef>string <parameter>glue</parameter></paramdef> <paramdef>array <parameter>pieces</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Funkce <function>join</function> je alias k <function>implode</function>, a je ve vech ohledech stejná. </simpara> <simpara> Viz také <function>explode</function>, <function>implode</function>, a <function>split</function>. </simpara> </refsect1> </refentry> <refentry id="function.levenshtein"> <refnamediv> <refname>levenshtein</refname> <refpurpose> Spoèítat XXX Levenshteinovu vzdálenost mezi dvìma øetìzci </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>levenshtein</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> <funcprototype> <funcdef>int <function>levenshtein</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>int <parameter>cost_ins</parameter></paramdef> <paramdef>int <parameter>cost_rep</parameter></paramdef> <paramdef>int <parameter>cost_del</parameter></paramdef> </funcprototype> <funcprototype> <funcdef>int <function>levenshtein</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>function <parameter>cost</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí ??? Levenshtein-Distance mezi pøedanými øetìzci nebo -1, pokud délka jednoho z pøedaných øetìzcù pøesáhne omezení 255 znakù (255 by mìlo být pro bìná porovnání víc ne dost, a nikdo se zdravým rozumem nebude v PHP dìlat genetickou analýzu). </para> <para> Levenshteinova vzdálenost se definuje jako minimální poèet znaku, které musíte nahradit, vloit nebo smazat, abyste zmìnili <parameter>str1</parameter> na <parameter>str2</parameter>. Sloitost tohoto algoritmu je <literal>O(m*n)</literal>, kde <literal>n</literal> a <literal>m</literal> jsou délky <parameter>str1</parameter> a <parameter>str2</parameter> (celkem sluné v porovnání se <function>similar_text</function>, který je O(max(n,m)**3), ale i tak drahé). </para> <para> Ve své nejjednoduí podobì tato funkce pouze vezme dva øetìzce jako argumenty a spoèítá poèet vloení, nahrazení a smazání nutných k transformaci <parameter>str1</parameter> na <parameter>str2</parameter>. </para> <para> Druhá varianta pøijme tøi dalí argumenty, které definují náklady na operace vloení, nahrazeni a smazání. Tato varianta je veobecnìjí a pøizpùsobivìjí ne varianta první, ale ne tak výkonná. </para> <para> Tøetí varianta (zatím neimplementovaná) bude nejveobecnìjí a nejpøizpùsobivìjí, ale také nejpomalejí alternativou. Bude volat uivatelskou funkci, která urèí náklady na vechny moné operace. </para> <para> Tato uivatelská funkce se bude volat s následujícími argumenty: <itemizedlist> <listitem> <simpara> operatce, která se má provést: 'I', 'R' or 'D' </simpara> </listitem> <listitem> <simpara> pùvodní znak v øetìzci 1 </simpara> </listitem> <listitem> <simpara> pùvodní znak v øetìzci 2 </simpara> </listitem> <listitem> <simpara> pozice v øetìzci 1 </simpara> </listitem> <listitem> <simpara> pozice v øetìzci 2 </simpara> </listitem> <listitem> <simpara> znaky zbývající v øetìzci 1 </simpara> </listitem> <listitem> <simpara> znaky zbývající v øetìzci 2 </simpara> </listitem> </itemizedlist> Tato uivatelská funkce musí vrátit kladné celé èíslo vyèíslující náklady na tuto konkrétní operaci, ale mùe se rozhodnout pouít pouze nìkteré z pøijatých argumentù. </para> <para> Tento pøístup nabízí monost zohlednit dùleitost urèitých symbolù (znakù) a/nebo rozdíly mezi nimi, èi dokonce kontext, ve kterém se vyskytují pøi urèování nákladù na vloení, zmìnu nebo smazání, ale za cenu ztráty vech optimalizací vyuití CPU registru a XXX cache misses, které byly zapracovány do pøedchozích dvou variant. </para> <para> Viz také <function>soundex</function>, <function>similar_text</function> a <function>metaphone</function>. </para> </refsect1> </refentry> <refentry id="function.ltrim"> <refnamediv> <refname>ltrim</refname> <refpurpose>Odstranit netisknutelné znaky ze zaèátku øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ltrim</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce oøízne netisknutelné znaky ze zaèátku øetìzce a vrátí oøíznutý øetìzec. Netisknutelné znaky, které se v souèasnosti odstraòují, jsou: "\n", "\r", "\t", "\v", "\0", a prostá mezera. </para> <para> Viz také <function>chop</function>, <function>rtrim</function>, a <function>trim</function>. </para> </refsect1> </refentry> <refentry id="function.md5"> <refnamediv> <refname>md5</refname> <refpurpose>Spoèítat MD5 XXX hash øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>md5</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Spoèítá MD5 XXX hash argumentu <parameter>str</parameter> pomocí <ulink url="&url.rfc;rfc1321.html">MD5 Message-Digest Algoritmu spoleènosti RSA Data Security, Inc.</ulink>. </para> <para> Viz také: <function>crc32</function> </para> </refsect1> </refentry> <refentry id="function.metaphone"> <refnamediv> <refname>Metaphone</refname> <refpurpose>Spoèítat metaphone klíè øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>metaphone</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Spoèítá metaphone klíè argumentu <parameter>str</parameter>. </para> <para> <function>etaphone</function>, podobnì jako <function>soundex</function>, vytvoøí stejný klíè pro podobnì znìjící slova. Je pøesnìjí ne <function>soundex</function>, protoe zná základní pravidla anglické výslovnosti. Metaphone klíèe mají promìnlivou délku. </para> <para> Metaphone vyvinul Lawrence Philips <lphilips@verity.com>. Je popsáno v ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995]. <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </para> </refsect1> </refentry> <refentry id="function.nl2br"> <refnamediv> <refname>nl2br</refname> <refpurpose>Pøevede konce øádkù na HTML XXX konce øádkù</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>nl2br</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí <parameter>string</parameter>, ve kterém je pøed kadý konec øádku vloen tag '<BR>'. </para> <para> Viz také <function>htmlspecialchars</function>, <function>htmlentities</function> a <function>wordwrap</function>. </para> </refsect1> </refentry> <refentry id="function.ord"> <refnamediv> <refname>Ord</refname> <refpurpose>Vrátit ASCII hodnotu znaku</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>ord</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí ASCII hodnotu prvního znaku v <parameter>string</parameter>. Tato funkce doplòuje <function>chr</function>. <example> <title>Ukázka <function>Ord</function></title> <programlisting role="php"> if (ord ($str) == 10) { echo "Prvním znakem \$str je line feed.\n"; } </programlisting> </example> </para> <simpara> Viz také <function>chr</function>. </simpara> </refsect1> </refentry> <refentry id="function.parse-str"> <refnamediv> <refname>parse_str</refname> <refpurpose>Rozloit øetìzec do promìnných</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>void <function>parse_str</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>array <parameter><optional>arr</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Rozloí øetìzec, jako kdyby to byl query string pøedaný v URL a definuje pøísluné promìnné v souèasném prostoru. Pokud je pøedán druhý argument <parameter>arr</parameter>, promìnné se místo toho uloí do této promìnné jako pole. </para> <para> <example> <title>Using <function>parse_str</function></title> <programlisting role="php"> $str = "first=value&second[]=this+works&second[]=another"; parse_str($str); echo $first; /* vytiskne "value" */ echo $second[0]; /* vytiskne "this works" */ echo $second[1]; /* vytiskne "another" */ </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.print"> <refnamediv> <refname>print</refname> <refpurpose>Vytisknout øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef><function>print</function></funcdef> <paramdef>string <parameter>arg</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Vytiskne <parameter>arg</parameter>. </simpara> <simpara> Viz také: <function>echo</function>, <function>printf</function>, a <function>flush</function>. </simpara> </refsect1> </refentry> <refentry id="function.printf"> <refnamediv> <refname>printf</refname> <refpurpose>Vytisknout formátovaný øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>printf</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed <parameter><optional>args</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> <simpara> Vytvoøí výtup podle argumentu <parameter>format</parameter>, který je popsán v dokumentaci <function>sprintf</function>. </simpara> <simpara> Viz také: <function>print</function>, <function>sprintf</function>, <function>sscanf</function>, <function>fscanf</function>, a <function>flush</function>. </simpara> </refsect1> </refentry> <refentry id="function.quoted-printable-decode"> <refnamediv> <refname>quoted_printable_decode</refname> <refpurpose> Pøevést quoted-printable øetìzec na osmibitový øetìzec </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>quoted_printable_decode</function> </funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Tato funkce vrátí osmibitový binární øetìzec odpovídající dekédovanému quoted printable øetìzci. Tato funkce je podobná <function>imap_qprint</function>, s tou výjimkou, e tato funkce nevyaduje IMAP modul. </simpara> </refsect1> </refentry> <refentry id="function.quotemeta"> <refnamediv> <refname>quotemeta</refname> <refpurpose>Opatøit lomítky metaznaky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>quotemeta</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí verzi <parameter>str</parameter> se zpìtným lomítkem pøed vemi výskyty následujících znakù: <screen>. \\ + * ? [ ^ ] ( $ )</screen> </para> <simpara> Viz také <function>addslashes</function>, <function>htmlentities</function>, <function>htmlspecialchars</function>, <function>nl2br</function>, a <function>stripslashes</function>. </simpara> </refsect1> </refentry> <refentry id="function.rtrim"> <refnamediv> <refname>rtrim</refname> <refpurpose>Odstranit netisknutelné znaky z konce øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcdef>string <function>rtrim</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcsynopsis> <para> Vrátí pøedaný øetìzec bez netisknutelných znakù (vè. koncù øádku) na konci. Toto je alias k <function>chop</function>. <example> <title>Ukázka <function>rtrim</function></title> <programlisting role="php"> $trimmed = rtrim ($line); </programlisting> </example> </para> <para> Viz také <function>trim</function>, <function>ltrim</function>, a <function>rtrim</function>. </para> </refsect1> </refentry> <refentry id="function.sscanf"> <refnamediv> <refname>sscanf</refname> <refpurpose>Parses input from a string according to a format</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>sscanf</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>string <parameter><optional>var1</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> <para> The function <function>sscanf</function> is the input analog of <function>printf</function>. <function>Sscanf</function> reads from the string <parameter>str</parameter> and interprets it according to the specified <parameter>format</parameter>. If only two parameters were passed to this function, the values parsed will be returned as an array. <example> <title>Ukázka <function>Sscanf</function> Example</title> <programlisting role="php"> // getting the serial number $serial = sscanf("SN/2350001","SN/%d"); // and the date of manufacturing $mandate = "January 01 2000"; list($month, $day, $year) = sscanf($mandate,"%s %d %d"); echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n"; </programlisting> </example> If optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference. <example> <title>Ukázka <function>Sscanf</function> - using optional parameters</title> <programlisting role="php"> // get author info and generate DocBook entry $auth = "24\tLewis Carroll"; $n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); echo "<author id='$id'> <firstname>$first</firstname> <surname>$last</surname> </author>\n"; </programlisting> </example> </para> <para> Viz také: <function>fscanf</function>, <function>printf</function>, and <function>sprintf</function>. </para> </refsect1> </refentry> <refentry id="function.setlocale"> <refnamediv> <refname>setlocale</refname> <refpurpose>Set locale information</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>setlocale</function></funcdef> <paramdef>string <parameter>category</parameter></paramdef> <paramdef>string <parameter>locale</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <parameter>Category</parameter> is a string specifying the category of the functions affected by the locale setting: <itemizedlist> <listitem> <simpara> LC_ALL for all of the below </simpara> </listitem> <listitem> <simpara> LC_COLLATE for string comparison - not currently implemented in PHP </simpara> </listitem> <listitem> <simpara> LC_CTYPE for character classification and conversion, for example <function>strtoupper</function> </simpara> </listitem> <listitem> <simpara> LC_MONETARY for localeconv() - not currently implemented in PHP </simpara> </listitem> <listitem> <simpara> LC_NUMERIC for decimal separator </simpara> </listitem> <listitem> <simpara> LC_TIME for date and time formatting with <function>strftime</function> </simpara> </listitem> </itemizedlist> </para> <para> If <parameter>locale</parameter> is the empty string <literal>""</literal>, the locale names will be set from the values of environment variables with the same names as the above categories, or from "LANG". </para> <para> If locale is zero or <literal>"0"</literal>, the locale setting is not affected, only the current setting is returned. </para> <para> Setlocale returns the new current locale, or false if the locale functionality is not implemented in the plattform, the specified locale does not exist or the category name is invalid. An invalid category name also causes a warning message. </para> </refsect1> </refentry> <refentry id="function.similar-text"> <refnamediv> <refname>similar_text</refname> <refpurpose> Calculate the similarity between two strings </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>similar_text</function></funcdef> <paramdef>string <parameter>first</parameter></paramdef> <paramdef>string <parameter>second</parameter></paramdef> <paramdef>double <parameter><optional>percent</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> This calculates the similarity between two strings as described in Oliver [1993]. Note that this implementation does not use a stack as in Oliver's pseudo code, but recursive calls which may or may not speed up the whole process. Note also that the complexity of this algorithm is O(N**3) where N is the length of the longest string. </para> <para> By passing a reference as third argument, <function>similar_text</function> will calculate the similarity in percent for you. It returns the number of matching chars in both strings. </para> </refsect1> </refentry> <refentry id="function.soundex"> <refnamediv> <refname>soundex</refname> <refpurpose>Calculate the soundex key of a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>soundex</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Calculates the soundex key of <parameter>str</parameter>. </para> <para> Soundex keys have the property that words pronounced similarly produce the same soundex key, and can thus be used to simplify searches in databases where you know the pronunciation but not the spelling. This soundex function returns a string 4 characters long, starting with a letter. </para> <para> This particular soundex function is one described by Donald Knuth in "The Art Of Computer Programming, vol. 3: Sorting And Searching", Addison-Wesley (1973), pp. 391-392. </para> <para> <example> <title>Soundex Examples</title> <programlisting role="php"> soundex ("Euler") == soundex ("Ellery") == 'E460'; soundex ("Gauss") == soundex ("Ghosh") == 'G200'; soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; soundex ("Knuth") == soundex ("Kant") == 'K530'; soundex ("Lloyd") == soundex ("Ladd") == 'L300'; soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.sprintf"> <refnamediv> <refname>sprintf</refname> <refpurpose>Return a formatted string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>sprintf</function></funcdef> <paramdef>string <parameter>format</parameter></paramdef> <paramdef>mixed <parameter><optional>args</optional></parameter>... </paramdef> </funcprototype> </funcsynopsis> <simpara> Returns a string produced according to the formatting string <parameter>format</parameter>. </simpara> <simpara> The format string is composed of zero or more directives: ordinary characters (excluding <literal>%</literal>) that are copied directly to the result, and <emphasis>conversion specifications</emphasis>, each of which results in fetching its own parameter. This applies to both <function>sprintf</function> and <function>printf</function>. </simpara> <para> Each conversion specification consists of a percent sign (<literal>%</literal>), followed by one or more of these elements, in order: <orderedlist> <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 <literal>0</literal> (zero character). The default is to pad with spaces. An alternate padding character can be specified by prefixing it with a single quote (<literal>'</literal>). See the examples below. </simpara> </listitem> <listitem> <simpara> An optional <emphasis>alignment specifier</emphasis> that says if the result should be left-justified or right-justified. The default is right-justified; a <literal>-</literal> character here will make it left-justified. </simpara> </listitem> <listitem> <simpara> An optional number, a <emphasis>width specifier</emphasis> that says how many characters (minimum) this conversion should result in. </simpara> </listitem> <listitem> <simpara> An optional <emphasis>precision specifier</emphasis> that says how many decimal digits should be displayed for floating-point numbers. This option has no effect for other types than double. (Another function useful for formatting numbers is <function>number_format</function>.) </simpara> </listitem> <listitem> <para> A <emphasis>type specifier</emphasis> that says what type the argument data should be treated as. Possible types: <simplelist> <member> <literal>%</literal> - a literal percent character. No argument is required. </member> <member> <literal>b</literal> - the argument is treated as an integer, and presented as a binary number. </member> <member> <literal>c</literal> - the argument is treated as an integer, and presented as the character with that ASCII value. </member> <member> <literal>d</literal> - the argument is treated as an integer, and presented as a decimal number. </member> <member> <literal>f</literal> - the argument is treated as a double, and presented as a floating-point number. </member> <member> <literal>o</literal> - the argument is treated as an integer, and presented as an octal number. </member> <member> <literal>s</literal> - the argument is treated as and presented as a string. </member> <member> <literal>x</literal> - the argument is treated as an integer and presented as a hexadecimal number (with lowercase letters). </member> <member> <literal>X</literal> - the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters). </member> </simplelist> </para> </listitem> </orderedlist> </para> <simpara> Viz také: <function>printf</function>, <function>sscanf</function>, <function>fscanf</function>, and <function>number_format</function>. </simpara> </refsect1> <refsect1> <title>Examples</title> <para> <example> <title>Ukázka <function>Sprintf</function>: zero-padded integers</title> <programlisting role="php"> $isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day); </programlisting> </example> <example> <title>Ukázka <function>Sprintf</function>: formatting currency</title> <programlisting role="php"> $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output "123.1"; $formatted = sprintf ("%01.2f", $money); // echo $formatted will output "123.10" </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.strncasecmp"> <refnamediv> <refname>strncasecmp</refname> <refpurpose> Binary safe case-insensitive string comparison of the first n characters </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strncasecmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>int <parameter>len</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function is similar to <function>strcasecmp</function>, with the difference that you can specify the (upper limit of the) number of characters (<parameter>len</parameter>) from each string to be used in the comparison. If any of the strings is shorter than <parameter>len</parameter>, then the length of that string will be used for the comparison. </para> <simpara> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>strcmp</function>, <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strcasecmp"> <refnamediv> <refname>strcasecmp</refname> <refpurpose> Binary safe case-insensitive string comparison </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strcasecmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. <example> <title>Ukázka <function>strcasecmp</function></title> <programlisting role="php"> $var1 = "Hello"; $var2 = "hello"; if (!strcasecmp ($var1, $var2)) { echo '$var1 is equal to $var2 in a case-insensitive string comparison'; } </programlisting> </example> </para> <simpara> Viz také <function>ereg</function>, <function>strcmp</function>, <function>substr</function>, <function>stristr</function>, <function>strncasecmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strchr"> <refnamediv> <refname>strchr</refname> <refpurpose> Find the first occurrence of a character </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strchr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function is an alias for <function>strstr</function>, and is identical in every way. </para> </refsect1> </refentry> <refentry id="function.strcmp"> <refnamediv> <refname>strcmp</refname> <refpurpose>Binary safe string comparison</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strcmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Note that this comparison is case sensitive. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strncasecmp</function>, <function>strncmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strcspn"> <refnamediv> <refname>strcspn</refname> <refpurpose> Find length of initial segment not matching mask </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strcspn</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns the length of the initial segment of <parameter>str1</parameter> which does <emphasis>not</emphasis> contain any of the characters in <parameter>str2</parameter>. </simpara> <simpara> Viz také <function>strspn</function>. </simpara> </refsect1> </refentry> <refentry id="function.strip-tags"> <refnamediv> <refname>strip_tags</refname> <refpurpose>Strip HTML and PHP tags from a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strip_tags</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter><optional>allowable_tags</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> This function tries to strip all HTML and PHP tags from the given string. It errors on the side of caution in case of incomplete or bogus tags. It uses the same tag stripping state machine as the <function>fgetss</function> function. </para> <para> You can use the optional second parameter to specify tags which should not be stripped. <note> <para> <parameter>Allowable_tags</parameter> was added in PHP 3.0.13, PHP4B3. </para> </note> </para> </refsect1> </refentry> <refentry id="function.stripcslashes"> <refnamediv> <refname>stripcslashes</refname> <refpurpose> Un-quote string quoted with <function>addcslashes</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>stripcslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns a string with backslashes stripped off. Recognizes C-like <literal>\n</literal>, <literal>\r</literal> ..., octal and hexadecimal representation. <note> <simpara> Added in PHP4b3-dev. </simpara> </note> </para> <simpara> Viz také <function>addcslashes</function>. </simpara> </refsect1> </refentry> <refentry id="function.stripslashes"> <refnamediv> <refname>stripslashes</refname> <refpurpose> Un-quote string quoted with <function>addslashes</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>stripslashes</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns a string with backslashes stripped off. (<literal>\'</literal> becomes <literal>'</literal> and so on.) Double backslashes are made into a single backslash. </para> <simpara> Viz také <function>addslashes</function>. </simpara> </refsect1> </refentry> <refentry id="function.stristr"> <refnamediv> <refname>stristr</refname> <refpurpose> Case-insensitive <function>strstr</function> </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>stristr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns all of <parameter>haystack</parameter> from the first occurrence of <parameter>needle</parameter> to the end. <parameter>needle</parameter> and <parameter>haystack</parameter> are examined in a case-insensitive manner. </para> <para> If <parameter>needle</parameter> is not found, returns false. </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> Viz také <function>strchr</function>, <function>strrchr</function>, <function>substr</function>, and <function>ereg</function>. </para> </refsect1> </refentry> <refentry id="function.strlen"> <refnamediv> <refname>strlen</refname> <refpurpose>Get string length</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strlen</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns the length of <parameter>string</parameter>. </para> </refsect1> </refentry> <refentry id="function.strnatcmp"> <refnamediv> <refname>strnatcmp</refname> <refpurpose> String comparisons using a "natural order" algorithm </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strnatcmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would, this is described as a "natural ordering". An example of the difference between this algorithm and the regular computer string sorting algorithms (used in <function>strcmp</function>) can be seen below: <informalexample> <programlisting> $arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); echo "Standard string comparison\n"; usort($arr1,"strcmp"); print_r($arr1); echo "\nNatural order string comparison\n"; usort($arr2,"strnatcmp"); print_r($arr2); </programlisting> </informalexample> The code above will generate the following output: <informalexample> <programlisting> Standard string comparison Array ( [0] => img1.png [1] => img10.png [2] => img12.png [3] => img2.png ) Natural order string comparison Array ( [0] => img1.png [1] => img2.png [2] => img10.png [3] => img12.png ) </programlisting> </informalexample> For more infomation see: Martin Pool's <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> page. </para> <simpara> Similar to other string comparison functions, this one returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Note that this comparison is case sensitive. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, <function>strncmp</function>, <function>strncasecmp</function>, <function>strnatcasecmp</function>, <function>strstr</function>, <function>natsort</function> and <function>natcasesort</function>. </simpara> </refsect1> </refentry> <refentry id="function.strnatcasecmp"> <refnamediv> <refname>strnatcasecmp</refname> <refpurpose> Case insensitive string comparisons using a "natural order" algorithm </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strnatcasecmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would. The behavior of this function is similar to <function>strnatcmp</function>, except that the comparison is not case sensitive. For more infomation see: Martin Pool's <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> page. </para> <simpara> Similar to other string comparison functions, this one returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Viz také <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, <function>strncmp</function>, <function>strncasecmp</function>, <function>strnatcmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.strncmp"> <refnamediv> <refname>strncmp</refname> <refpurpose> Binary safe string comparison of the first n characters </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strncmp</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> <paramdef>int <parameter>len</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function is similar to <function>strcmp</function>, with the difference that you can specify the (upper limit of the) number of characters (<parameter>len</parameter>) from each string to be used in the comparison. If any of the strings is shorter than <parameter>len</parameter>, then the length of that string will be used for the comparison. </para> <simpara> Returns < 0 if <parameter>str1</parameter> is less than <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> is greater than <parameter>str2</parameter>, and 0 if they are equal. </simpara> <simpara> Note that this comparison is case sensitive. </simpara> <simpara> Viz také <function>ereg</function>, <function>strncasecmp</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, and <function>strstr</function>. </simpara> </refsect1> </refentry> <refentry id="function.str-pad"> <refnamediv> <refname>str_pad</refname> <refpurpose>Pad a string to a certain length with another string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>str_pad</function></funcdef> <paramdef>string <parameter>input</parameter></paramdef> <paramdef>int <parameter>pad_length</parameter></paramdef> <paramdef>string <parameter><optional>pad_string</optional></parameter></paramdef> <paramdef>int <parameter><optional>pad_type</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> This functions pads the <parameter>input</parameter> string on the left, the right, or both sides to the specifed padding length. If the optional argument <parameter>pad_string</parameter> is not supplied, the <parameter>input</parameter> is padded with spaces, otherwise it is padded with characters from <parameter>pad_string</parameter> up to the limit. </para> <para> Optional argument <parameter>pad_type</parameter> can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If <parameter>pad_type</parameter> is not specified it is assumed to be STR_PAD_RIGHT. </para> <para> If the value of <parameter>pad_length</parameter> is negative or less than the length of the input string, no padding takes place. </para> <para> <example> <title>Ukázka <function>str_pad</function></title> <programlisting role="php"> $input = "Alien"; print str_pad($input, 10); // produces "Alien " print str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien" print str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___" </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.strpos"> <refnamediv> <refname>strpos</refname> <refpurpose> Find position of first occurrence of a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> <paramdef>int <parameter><optional>offset</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Returns the numeric position of the first occurrence of <parameter>needle</parameter> in the <parameter>haystack</parameter> string. Unlike the <function>strrpos</function>, this function can take a full string as the <parameter>needle</parameter> parameter and the entire string will be used. </para> <para> If <parameter>needle</parameter> is not found, returns false. <note> <para> It is easy to mistake the return values for "character found at position 0" and "character not found". Here's how to detect the difference: <informalexample> <programlisting role="php"> // in PHP 4.0b3 and newer: $pos = strpos ($mystring, "b"); if ($pos === false) { // note: three equal signs // not found... } // in versions older than 4.0b3: $pos = strpos ($mystring, "b"); if (is_string ($pos) && !$pos) { // not found... } </programlisting> </informalexample> </para> </note> </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> The optional <parameter>offset</parameter> parameter allows you to specify which character in <parameter>haystack</parameter> to start searching. The position returned is still relative to the the beginning of <parameter>haystack</parameter>. </para> <para> Viz také <function>strrpos</function>, <function>strrchr</function>, <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </para> </refsect1> </refentry> <refentry id="function.strrchr"> <refnamediv> <refname>strrchr</refname> <refpurpose> Find the last occurrence of a character in a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strrchr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> This function returns the portion of <parameter>haystack</parameter> which starts at the last occurrence of <parameter>needle</parameter> and goes until the end of <parameter>haystack</parameter>. </para> <para> Returns false if <parameter>needle</parameter> is not found. </para> <para> If <parameter>needle</parameter> contains more than one character, the first is used. </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. <example> <title>Ukázka <function>Strrchr</function></title> <programlisting role="php"> // get last directory in $PATH $dir = substr (strrchr ($PATH, ":"), 1); // get everything after last newline $text = "Line 1\nLine 2\nLine 3"; $last = substr (strrchr ($text, 10), 1 ); </programlisting> </example> </para> <para> Viz také <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </para> </refsect1> </refentry> <refentry id="function.str-repeat"> <refnamediv> <refname>str_repeat</refname> <refpurpose>Repeat a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>str_repeat</function></funcdef> <paramdef>string <parameter>input</parameter></paramdef> <paramdef>int <parameter>multiplier</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns <parameter>input_str</parameter> repeated <parameter>multiplier</parameter> times. <parameter>multiplier</parameter> has to be greater than 0. </para> <example> <title>Ukázka <function>Str_repeat</function></title> <programlisting role="php"> echo str_repeat ("-=", 10); </programlisting> </example> <para> This will output "-=-=-=-=-=-=-=-=-=-=". </para> <note> <para> Tato funkce byla pøidána v PHP 4.0. </para> </note> </refsect1> </refentry> <refentry id="function.strrev"> <refnamediv> <refname>strrev</refname> <refpurpose>Reverse a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strrev</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns <parameter>string</parameter>, reversed. </para> </refsect1> </refentry> <refentry id="function.strrpos"> <refnamediv> <refname>strrpos</refname> <refpurpose> Find position of last occurrence of a char in a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strrpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>char <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns the numeric position of the last occurrence of <parameter>needle</parameter> in the <parameter>haystack</parameter> string. Note that the needle in this case can only be a single character. If a string is passed as the needle, then only the first character of that string will be used. </para> <para> If <parameter>needle</parameter> is not found, returns false. <note> <para> It is easy to mistake the return values for "character found at position 0" and "character not found". Here's how to detect the difference: <informalexample> <programlisting role="php"> // in PHP 4.0b3 and newer: $pos = strrpos ($mystring, "b"); if ($pos === false) { // note: three equal signs // not found... } // in versions older than 4.0b3: $pos = strrpos ($mystring, "b"); if (is_string ($pos) && !$pos) { // not found... } </programlisting> </informalexample> </para> </note> </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> Viz také <function>strpos</function>, <function>strrchr</function>, <function>substr</function>, <function>stristr</function>, and <function>strstr</function>. </para> </refsect1> </refentry> <refentry id="function.strspn"> <refnamediv> <refname>strspn</refname> <refpurpose> Find length of initial segment matching mask </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>strspn</function></funcdef> <paramdef>string <parameter>str1</parameter></paramdef> <paramdef>string <parameter>str2</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> Returns the length of the initial segment of <parameter>str1</parameter> which consists entirely of characters in <parameter>str2</parameter>. </simpara> <para> <informalexample> <programlisting role="php"> strspn ("42 is the answer, what is the question ...", "1234567890"); </programlisting> <para> will return 2 as result. </para> </informalexample> </para> <simpara> Viz také <function>strcspn</function>. </simpara> </refsect1> </refentry> <refentry id="function.strstr"> <refnamediv> <refname>strstr</refname> <refpurpose>Find first occurrence of a string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strstr</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns all of <parameter>haystack</parameter> from the first occurrence of <parameter>needle</parameter> to the end. </para> <para> If <parameter>needle</parameter> is not found, returns false. </para> <para> If <parameter>needle</parameter> is not a string, it is converted to an integer and applied as the ordinal value of a character. </para> <para> <note> <para> Note that this function is case-sensitive. For case-insensitive searches, use <function>stristr</function>. </para> </note> </para> <para> <example> <title>Ukázka <function>Strstr</function></title> <programlisting role="php"> $email = 'sterling@designmultimedia.com'; $domain = strstr ($email, '@'); print $domain; // prints @designmultimedia.com </programlisting> </example> </para> <para> Viz také <function>stristr</function>, <function>strrchr</function>, <function>substr</function>, and <function>ereg</function>. </para> </refsect1> </refentry> <refentry id="function.strtok"> <refnamediv> <refname>strtok</refname> <refpurpose>Tokenize string</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtok</function></funcdef> <paramdef>string <parameter>arg1</parameter></paramdef> <paramdef>string <parameter>arg2</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>strtok</function> is used to tokenize a string. That is, if you have a string like "This is an example string" you could tokenize this string into its individual words by using the space character as the token. <example> <title>Ukázka <function>Strtok</function></title> <programlisting role="php"> $string = "This is an example string"; $tok = strtok ($string," "); while ($tok) { echo "Word=$tok<br>"; $tok = strtok (" "); } </programlisting> </example> </para> <para> Note that only the first call to strtok uses the string argument. Every subsequent call to strtok only needs the token to use, as it keeps track of where it is in the current string. To start over, or to tokenize a new string you simply call strtok with the string argument again to initialize it. Note that you may put multiple tokens in the token parameter. The string will be tokenized when any one of the characters in the argument are found. </para> <para> Also be careful that your tokens may be equal to "0". This evaluates to false in conditional expressions. </para> <para> Viz také <function>split</function> and <function>explode</function>. </para> </refsect1> </refentry> <refentry id="function.strtolower"> <refnamediv> <refname>strtolower</refname> <refpurpose>Zmìnit øetìzec na malá písmena</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtolower</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí <parameter>string</parameter> se vemi abecedními znaky zmìnìnými na malá písmena </para> <para> Pozn.: co je 'abecední' je dáno aktuálním místním nastavením. Napøíklad ve standardním místním nastavení "C" se znaky jako pøehlasované a (Ä) nepøevedou. </para> <example> <title>Ukázka <function>Strtolower</function></title> <programlisting role="php"> $str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtolower($str); print $str; # vytiskne mary had a little lamb and she loved it so </programlisting> </example> <para> Viz také <function>strtoupper</function> a <function>ucfirst</function>. </para> </refsect1> </refentry> <refentry id="function.strtoupper"> <refnamediv> <refname>strtoupper</refname> <refpurpose>Zmìnit øetìzec na velká písmena</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtoupper</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí <parameter>string</parameter> se vemi abecedními znaky zmìnìnými na velká písmena. </para> <para> Pozn.: co je 'abecední' je dáno aktuálním místním nastavením. Napøíklad ve standardním místním nastavení "C" se znaky jako pøehlasované a (ä) nepøevedou. </para> <example> <title>Ukázka <function>strtoupper</function></title> <programlisting role="php"> $str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtoupper ($str); print $str; # vytiskne MARY HAD A LITTLE LAMB AND SHE LOVED IT SO </programlisting> </example> <para> Viz také <function>strtolower</function> a <function>ucfirst</function>. </para> </refsect1> </refentry> <refentry id="function.str-replace"> <refnamediv> <refname>str_replace</refname> <refpurpose> Nahradit vechny výskyty jednoho øetìzce v jiném dalím øetìzcem </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>str_replace</function></funcdef> <paramdef>string <parameter>needle</parameter></paramdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>haystack</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce nahradí vechny výskyty argumentu <parameter>needle</parameter> v <parameter>haystack</parameter> argumentem <parameter>str</parameter>. Pokud nepotøebujete sloitá pravidla pro nahrazování, mìli byste vdy pouít tuto funkci místo <function>ereg_replace</function>. </para> <para> <example> <title>Ukázka <function>str_replace</function></title> <programlisting role="php"> $bodytag = str_replace ("%body%", "black", "<body text=%body%>"); </programlisting> </example> </para> <para> Tato funkce je XXX binárnì bezpeèná. </para> <note> <para> <function>Str_replace</function> was added in PHP 3.0.6, but was buggy up until PHP 3.0.8. </para> </note> <para> Viz také <function>ereg_replace</function> and <function>strtr</function>. </para> </refsect1> </refentry> <refentry id="function.strtr"> <refnamediv> <refname>strtr</refname> <refpurpose>Pøeloit urèité znaky</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>strtr</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>string <parameter>from</parameter></paramdef> <paramdef>string <parameter>to</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce upraví <parameter>str</parameter> tak, e vechny výskyty vech znakù ve <parameter>from</parameter> pøeloí na odpovídající znaky v <parameter>to</parameter> a vrátí výsledek. </para> <para> Pokud jsou <parameter>from</parameter> a <parameter>to</parameter> rùznì dlouhé, pøebývající znaky z delího z tìch dvou se ignorují. <example> <title>Ukázka <function>strtr</function></title> <programlisting role="php"> $addr = strtr($addr, "äåö", "aao"); </programlisting> </example> </para> <para> <function>strtr</function> se dá také volat pouze se dvìma argumenty. Pøi volání se dvìma argumenty se chová takto: <parameter>from</parameter> musí být pole obsahující páry øetìzcù, které se zamìní ve zdrojovém øetìzci. <function>strtr</function> vdy hledá nejdelí monou shodu a *NENAHRAZUJE* ty èásti øetìzce, na kterých u pracovala. </para> <para> Ukázky: <informalexample> <programlisting role="php"> $trans = array ("ahoj" => "nazdar", "nazdar" => "ahoj"); echo strtr("nazdar lidi, øekl jsem ahoj", $trans) . "\n"; </programlisting> </informalexample> Výsledek: "ahoj lidi, øekl jsem nazdar", </para> <note> <simpara> Tato vlastnost (dva argumenty) byla pøidána v PHP 4.0. </simpara> </note> <para> Viz také <function>ereg_replace</function>. </para> </refsect1> </refentry> <refentry id="function.substr"> <refnamediv> <refname>substr</refname> <refpurpose>Vrátit èást øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>substr</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>int <parameter>start</parameter></paramdef> <paramdef>int <parameter><optional>length</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>substr</function> vrátí èást argumentu <parameter>string</parameter> urèenou argumenty <parameter>start</parameter> a <parameter>length</parameter>. </para> <para> Pokud je <parameter>start</parameter> pozitivní, vrácený øetìzec zaène <parameter>start</parameter>-tým znakem øetìzce <parameter>string</parameter>, poèítáno od nuly. Napøíklad v øetìzci '<literal>abcdef</literal>' je znakem na <literal>0</literal>-té pozici '<literal>a</literal>', znakem na pozici <literal>2</literal> je '<literal>c</literal>', atd. </para> <para> Pøíklady: <informalexample> <programlisting role="php"> $rest = substr ("abcdef", 1); // vrátí "bcdef" $rest = substr ("abcdef", 1, 3); // vrátí "bcd" </programlisting> </informalexample> </para> <para> Pokud je <parameter>start</parameter> negativní, vrácený øetìzec zaène <parameter>start</parameter>-tým znakem od konce argumentu <parameter>string</parameter>. </para> <para> Pøíklady: <informalexample> <programlisting role="php"> $rest = substr ("abcdef", -1); // vrátí "f" $rest = substr ("abcdef", -2); // vrátí "ef" $rest = substr ("abcdef", -3, 1); // vrátí "d" </programlisting> </informalexample> </para> <para> Pokud je argument <parameter>length</parameter> kladný, vrácený øetìzec skonèí <parameter>length</parameter> znakù od <parameter>start</parameter>. Pokud by to znamenalo øetìzec se zápornou délkou (<parameter>start</parameter> je za <parameter>length</parameter>), vrácený øetìzec bude sestávat z jediného znaku na pozici <parameter>start</parameter>. </para> <para> Pokud je argument <parameter>length</parameter> kladný, vrácený øetìzec skonèí <parameter>length</parameter> znakù od konce argumentu <parameter>string</parameter>. Pokud by to znamenalo øetìzec se zápornou délkou, vrácený øetìzec bude sestávat z jediného znaku na pozici <parameter>start</parameter>. </para> <para> Pøíklady: <informalexample> <programlisting role="php"> $rest = substr ("abcdef", 1, -1); // vrátí "bcde" </programlisting> </informalexample> </para> <para> Viz také <function>strrchr</function> a <function>ereg</function>. </para> </refsect1> </refentry> <refentry id="function.substr-count"> <refnamediv> <refname>substr_count</refname> <refpurpose>Spoèítat poèet výskytù øetìzce</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>int <function>substr_count</function></funcdef> <paramdef>string <parameter>haystrack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>substr_count</function> vrátí poèet výskytù øetìzce <parameter>needle</parameter> v øetìzci <parameter>haystack</parameter> string. </para> <para> <example> <title>Ukázka <function>substr_count</function></title> <programlisting> print substr_count("This is a test", "is"); // prints out 2 </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.substr-replace"> <refnamediv> <refname>substr_replace</refname> <refpurpose>Nahradit èást øetìzce jiným øetìzcem</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>substr_replace</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> <paramdef>string <parameter>replacement</parameter></paramdef> <paramdef>int <parameter>start</parameter></paramdef> <paramdef>int <parameter><optional>length</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> <function>substr_replace</function> nahradí èást øetìzce <parameter>string</parameter> ohranièenou argumenty <parameter>start</parameter> a (volitelnì) <parameter>length</parameter> øetìzcem v argumentu <parameter>replacement</parameter>. Vrátí výsledek. </para> <para> Pokud je <parameter>start</parameter> pozitivní, náhrada zaène na <parameter>start</parameter>-tém znaku argumentu <parameter>string</parameter>. </para> <para> Pokud je <parameter>start</parameter> negativní, náhrada zaène na <parameter>start</parameter>-tém znaku od konce argumentu <parameter>string</parameter>. </para> <para> Pokud je pøítomen <parameter>length</parameter>, a je pozitivní, pøedstavuje délku èásti argumentu <parameter>string</parameter>, která bude nahraena. Pokud je negativní, pøedstavuje poèet znakù od konce <parameter>string</parameter>, kde má nahrazování skonèit. Pokud pøítomen není, bere se standardnì strlen( <parameter>string</parameter> ); tj. nahrazování konèí na konci argumentu <parameter>string</parameter>. </para> <para> <example> <title>Ukázka <function>Substr_replace</function></title> <programlisting role="php"> <?php $var = 'ABCDEFGH:/MNRPQR/'; echo "Originál: $var<hr>\n"; /* Tyto dva pøíklady nahradí celý obsah promìnné $var øetìzcem 'bob'. */ echo substr_replace ($var, 'bob', 0) . "<br>\n"; echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; /* Toto vloí 'bob' na zaèátek $var. */ echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; /* Tyto dva pøíklady nahradí 'MNRPQR' ve $var øetìzcem 'bob'. */ echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; /* Toto z $var odstraní 'MNRPQR'. */ echo substr_replace ($var, '', 10, -1) . "<br>\n"; ?> </programlisting> </example> </para> <para> Viz také <function>str_replace</function> a <function>substr</function>. </para> <note> <simpara> Funkce <function>substr_replace</function> byla pøidána v PHP 4.0. </simpara> </note> </refsect1> </refentry> <refentry id="function.trim"> <refnamediv> <refname>trim</refname> <refpurpose> Odstranit netisknutelné znaky ze zaèátku a konce øetìzce </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>trim</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce odstraní netisknutelné znaky ze zaèátku a konce øetìzce a vrátí øetìzec bez tìchto znakù. Netisknutelné znaky, které se v souèasnosti odstraòují, jsou: "\n", "\r", "\t", "\v", "\0", a mezera. </para> <para> Viz také <function>chop</function>, <function>rtrim</function> a <function>ltrim</function>. </para> </refsect1> </refentry> <refentry id="function.ucfirst"> <refnamediv> <refname>ucfirst</refname> <refpurpose>Make a string's first character uppercase</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ucfirst</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Capitalizes the first character of <parameter>str</parameter> if that character is alphabetic. </para> <para> Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted. <example> <title>Ukázka <function>Ucfirst</function></title> <programlisting role="php"> $text = 'mary had a little lamb and she loved it so.'; $text = ucfirst ($text); // $text is now Mary had a little lamb // and she loved it so. </programlisting> </example> </para> <para> Viz také <function>strtoupper</function> and <function>strtolower</function>. </para> </refsect1> </refentry> <refentry id="function.ucwords"> <refnamediv> <refname>ucwords</refname> <refpurpose> Uppercase the first character of each word in a string </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>ucwords</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Capitalizes the first character of each word in <parameter>str</parameter> if that character is alphabetic. <example> <title>Ukázka <function>ucwords</function></title> <programlisting role="php"> $text = "mary had a little lamb and she loved it so."; $text = ucwords($text); // $text is now: Mary Had A Little // Lamb And She Loved It So. </programlisting> </example> <note> <simpara> The definition of a word is any string of characters that is immediately after a whitespace (These are: space, form-feed, newline, carriage return, horizontal tab, and vertical tab). </simpara> </note> </para> <para> Viz také <function>strtoupper</function>, <function>strtolower</function> and <function>ucfirst</function>. </para> </refsect1> </refentry> <refentry id="function.wordwrap"> <refnamediv> <refname>wordwrap</refname> <refpurpose> Wraps a string to a given number of characters using a string break character. </refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>wordwrap</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> <paramdef>int <parameter><optional>width</optional></parameter> </paramdef> <paramdef>string <parameter><optional>break</optional></parameter> </paramdef> <paramdef>int <parameter><optional>cut</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Wraps the string <parameter>str</parameter> at the column number specified by the (optional) <parameter>width</parameter> parameter. The line is broken using the (optional) <parameter>break</parameter> parameter. </para> <para> <function>wordwrap</function> will automatically wrap at column 75 and break using '\n' (newline) if <parameter>width</parameter> or <parameter>break</parameter> are not given. </para> <para> If the <parameter>cut</parameter> is set to 1, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken appart. (See second example). <note> <para> The <parameter>cut</parameter> parameter was added in PHP 4.0.3. </para> </note> </para> <para> <example> <title>Ukázka <function>wordwrap</function></title> <programlisting role="php"> $text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap( $text, 20 ); echo "$newtext\n"; </programlisting> </example> </para> <para> This example would display: </para> <para> <informalexample> <programlisting> The quick brown fox jumped over the lazy dog. </programlisting> </informalexample> </para> <para> <example> <title>Ukázka <function>wordwrap</function></title> <programlisting role="php"> $text = "A very long woooooooooooord."; $newtext = wordwrap( $text, 8, "\n", 1); echo "$newtext\n"; </programlisting> </example> </para> <para> This example would display: </para> <para> <informalexample> <programlisting> A very long wooooooo ooooord. </programlisting> </informalexample> </para> <para> Viz také <function>nl2br</function>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/cs/functions/url.xml +++ phpdoc/cs/functions/url.xml <reference id="ref.url"> <title>URL Functions</title> <titleabbrev>URLs</titleabbrev> <refentry id="function.base64-decode"> <refnamediv> <refname>base64_decode</refname> <refpurpose>Dekódovat data kódovaná pomocí MIME base64</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>base64_decode</function></funcdef> <paramdef>string <parameter>encoded_data</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Base64_decode</function> dekóduje <parameter>encoded_data</parameter> a vrátí pùvodní data. Vrácená data mohou být binární </para> <para> Viz také: <function>base64_encode</function>, RFC 2045 sekce 6.8. </para> </refsect1> </refentry> <refentry id="function.base64-encode"> <refnamediv> <refname>base64_encode</refname> <refpurpose>Zakódovat data pomocí MIME base64</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>base64_encode</function></funcdef> <paramdef>string <parameter>data</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>Base64_encode</function> vrátí <parameter>data</parameter> zakódovaný pomocí base64. Toto kódování je navreno tak, aby umonilo binárním datùm pøeít transport pøenosovými vrstvami, které nejsou osmibitové, jako jsou napøíklad tìla emailù. </para> <para> Data kódovaná pomocí base64 zabírají o zhruba 33% prostoru více ne pùvodní data. </para> <para> Viz také: <function>base64_decode</function>, <function>chunk_split</function>, RFC-2045 sekce 6.8. </para> </refsect1> </refentry> <refentry id="function.parse-url"> <refnamediv> <refname>parse_url</refname> <refpurpose>Rozebrat URL a vrátit její komponenty</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>array <function>parse_url</function></funcdef> <paramdef>string <parameter>url</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Tato funkce vrátí asociativní pole vech komponent URL pøítomnych v <parameter>url</parameter>. Ty mohou být: "scheme", "host", "port", "user", "pass", "path", "query" a "fragment". </para> </refsect1> </refentry> <refentry id="function.rawurldecode"> <refnamediv> <refname>rawurldecode</refname> <refpurpose>Dekódovat URL-kódovaný øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>rawurldecode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec, ve kterém sekvence znaku procent (<literal>%</literal>) následových dvìma estnáctkovými èíslicemi byly nahrazeny prostými znaky. Napøíklad øetìzec <screen>foo%20bar%40baz</screen> dekóduje na <screen>foo bar@baz</screen>. </para> <simpara> Viz také: <function>rawurlencode</function>, <function>urldecode</function>, <function>urlencode</function>. </simpara> </refsect1> </refentry> <refentry id="function.rawurlencode"> <refnamediv> <refname>rawurlencode</refname> <refpurpose>URL-kódovat podle RFC1738</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>rawurlencode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec, ve kterém byly vechny nealfanumerické znaky kromì <screen>-_.</screen> nahrazeny znakem procent (<literal>%</literal>) následovaným dvìma estnáctkovými èíslicemi. To je kódování popsané v RFC1738 na ochranu prostých znakù pøed interpretací jako zvlátní oddìlovaèe v URL a na ochranu URL pøed komolením pøenosovými systémy se znakovými konvencemi (jako jsou nìkteré emailové systémy). Napøíklad, pokud chcete k FTP URL pøidat heslo: <example> <title>Pøíklad <function>rawurlencode</function> è. 1</title> <programlisting role="php"> echo '<A HREF="ftp://user:', rawurlencode ('foo @+%/'), '@ftp.my.com/x.txt">'; </programlisting> </example> Nebo, pokud pøedáváte informace v komponentì URL obsahující info o cestì: <example> <title>Pøíklad <function>rawurlencode</function> è. 2</title> <programlisting role="php"> echo '<A HREF="http://x.com/department_list_script/', rawurlencode ('sales and marketing/Miami'), '">'; </programlisting> </example> </para> <simpara> Viz také: <function>rawurldecode</function>, <function>urldecode</function>, <function>urlencode</function>. </simpara> </refsect1> </refentry> <refentry id="function.urldecode"> <refnamediv> <refname>urldecode</refname> <refpurpose>Dekódovat URL-kódovaný øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>urldecode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Dekóduje vechny <literal>%<replaceable>##</replaceable></literal> kódy v daném øetìzci. Vrátí dekódovaný øetìzec. <example> <title>Pøíklad <function>urldecode</function></title> <programlisting role="php"> $a = split ('&', $querystring); $i = 0; while ($i < count ($a)) { $b = split ('=', $a [$i]); echo 'Hodnota argumentu ', htmlspecialchars (urldecode ($b [0])), ' je ', htmlspecialchars (urldecode ($b [1])), "<BR>"; $i++; } </programlisting> </example> </para> <para> Viz také <function>urlencode</function>, <function>rawurlencode</function>, <function>rawurldecode</function>. </para> </refsect1> </refentry> <refentry id="function.urlencode"> <refnamediv> <refname>urlencode</refname> <refpurpose>URL-kódovat øetìzec</refpurpose> </refnamediv> <refsect1> <title>Popis</title> <funcsynopsis> <funcprototype> <funcdef>string <function>urlencode</function></funcdef> <paramdef>string <parameter>str</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Vrátí øetìzec, ve kterém byly vechny nealfanumerické znaky kromì <literal>-_.</literal> nahrazeny znakem procent (<literal>%</literal>) následovaným dvìma estnácktovými èíslicemi a mezery kódovány jako znaky plus (<literal>+</literal>). Kódování je stejné jako u dat postovaných z WWW formuláøe, tj. stejnì jako u <literal>application/x-www-form-urlencoded</literal> typu. To se lií od RFC1738 kódování (viz <function>rawurlencode</function>) v tom, e z historických dùvodù se mezery kódují jako znaky plus (<literal>+</literal>). Tato funkce je vhodná pøi kódování øetìzce, který se má pouít jako query èást URL jako pøíhodný zpùsob pøedání promìnných na dalí stránku: <example> <title>Pøíklad <function>Urlencode</function></title> <programlisting role="php"> echo '<A HREF="mycgi?foo=', urlencode ($userinput), '">'; </programlisting> </example> </para> <para> Poznámka: pozor pøi pøedávání promìnných, které by mohly odpovídat HTML entitám. Vìci jako &amp, &copy a &pound browser analyzuje a místo poadovaného jména promìnné pouije odpovídající entitu. To je zøejmý problém, na který W3C upozoròuje u léta. Pøíruèka je tady: <ulink url="&url.argsep;">&url.argsep;</ulink> PHP podporuje zmìnu oddìlovaèe argumentù na støedník doporuèovaný W3C skrze .ini direktivu arg_separator. Bohuel, vìtina uivatelských programù neposílá data z formuláøù v tomto formátu. Pøenositelnìjí formou je pouít jako oddìlovaè &amp; místo &. Na to nemusíte mìnit arg_separator. Nechte ho na &, ale kódujte URL pomocí <function>htmlentities</function> (urlencode($data)). <example> <title>Pøíklad na <function>urlencode/htmlentities</function></title> <programlisting role="php"> echo '<A HREF="mycgi?foo=', htmlentities (urlencode ($userinput) ), '">'; </programlisting> </example> </para> <para> Viz také <function>urldecode</function>, <function>htmlentities</function>, <function>rawurldecode</function>, <function>rawurlencode</function>. </para> </refsect1> </refentry> </reference> <!-- 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 sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: -->