WS, prepare for new doc style

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@237386 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2007-06-11 00:50:00 +00:00
parent 9e528680d8
commit a988f7effc
11 changed files with 488 additions and 498 deletions

View file

@ -1,55 +1,55 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- $Revision: 1.10 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.addcslashes">
<refnamediv>
<refname>addcslashes</refname>
<refpurpose>Quote string with slashes in a C style</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>addcslashes</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>string</type><parameter>charlist</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string with backslashes before characters that are
listed in <parameter>charlist</parameter> parameter. If
<parameter>charlist</parameter> contains characters
<literal>\n</literal>, <literal>\r</literal> etc., they are
converted in C-like style, while other non-alphanumeric characters
with ASCII codes lower than 32 and higher than 126 converted to
octal representation.
</para>
<para>
Be careful if you choose to escape characters 0, a, b, f, n, r,
t and v. They will be converted to \0, \a, \b, \f, \n, \r, \t
and \v.
In PHP \0 (NULL), \r (carriage return), \n (newline) and \t (tab)
are predefined escape sequences, while in C all of these are
predefined escape sequences.
</para>
<para>
<parameter>charlist</parameter> like "\0..\37", which would
escape all characters with ASCII code between 0 and 31.
<example>
<title><function>addcslashes</function> example</title>
<programlisting role="php">
<refentry id="function.addcslashes">
<refnamediv>
<refname>addcslashes</refname>
<refpurpose>Quote string with slashes in a C style</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>addcslashes</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>string</type><parameter>charlist</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string with backslashes before characters that are
listed in <parameter>charlist</parameter> parameter. If
<parameter>charlist</parameter> contains characters
<literal>\n</literal>, <literal>\r</literal> etc., they are
converted in C-like style, while other non-alphanumeric characters
with ASCII codes lower than 32 and higher than 126 converted to
octal representation.
</para>
<para>
Be careful if you choose to escape characters 0, a, b, f, n, r,
t and v. They will be converted to \0, \a, \b, \f, \n, \r, \t
and \v.
In PHP \0 (NULL), \r (carriage return), \n (newline) and \t (tab)
are predefined escape sequences, while in C all of these are
predefined escape sequences.
</para>
<para>
<parameter>charlist</parameter> like "\0..\37", which would
escape all characters with ASCII code between 0 and 31.
<example>
<title><function>addcslashes</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$escaped = addcslashes($not_escaped, "\0..\37!@\177..\377");
?>
]]>
</programlisting>
</example>
</para>
<para>
When you define a sequence of characters in the charlist argument
make sure that you know what characters come between the
characters that you set as the start and end of the range.
<informalexample>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
When you define a sequence of characters in the charlist argument
make sure that you know what characters come between the
characters that you set as the start and end of the range.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
echo addcslashes('foo[ ]', 'A..z');
@ -59,33 +59,33 @@ echo addcslashes('foo[ ]', 'A..z');
// feeds, carriage returns, etc.
?>
]]>
</programlisting>
</informalexample>
Also, if the first character in a range has a higher ASCII value
than the second character in the range, no range will be
constructed. Only the start, end and period characters will be
escaped. Use the <function>ord</function> function to find the
ASCII value for a character.
<informalexample>
<programlisting role="php">
</programlisting>
</informalexample>
Also, if the first character in a range has a higher ASCII value
than the second character in the range, no range will be
constructed. Only the start, end and period characters will be
escaped. Use the <function>ord</function> function to find the
ASCII value for a character.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
echo addcslashes("zoo['.']", 'z..A');
// output: \zoo['\.']
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
See also <function>stripcslashes</function>,
<function>stripslashes</function>,
<function>addslashes</function>,
<function>htmlspecialchars</function>, and
<function>quotemeta</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</informalexample>
</para>
<para>
See also <function>stripcslashes</function>,
<function>stripslashes</function>,
<function>addslashes</function>,
<function>htmlspecialchars</function>, and
<function>quotemeta</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,51 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.addslashes">
<refnamediv>
<refname>addslashes</refname>
<refpurpose>Quote string with slashes</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>addslashes</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string with backslashes before characters that need
to be quoted in database queries etc. These characters are
single quote (<literal>'</literal>), double quote
(<literal>"</literal>), backslash (<literal>\</literal>)
and NUL (the &null; byte).
</para>
<para>
An example use of <function>addslashes</function> is when you're
entering data into a database. For example, to insert the name
<literal>O'reilly</literal> into a database, you will need to escape
it. Most databases do this with a <literal>\</literal> which would
mean <literal>O\'reilly</literal>. This would only be to get the data
into the database, the extra <literal>\</literal> will not be inserted.
Having the PHP directive <link linkend="ini.magic-quotes-sybase">
magic_quotes_sybase</link> set to <literal>on</literal> will mean
<literal>'</literal> is instead escaped with another
<literal>'</literal>.
</para>
<para>
The PHP directive <link linkend="ini.magic-quotes-gpc">
magic_quotes_gpc</link> is <literal>on</literal> by default, and it
essentially runs <function>addslashes</function> on all GET, POST,
and COOKIE data. Do not use <function>addslashes</function> on
strings that have already been escaped with
<link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> as you'll
then do double escaping. The function
<function>get_magic_quotes_gpc</function> may come in handy for
checking this.
</para>
<para>
<example>
<title>An <function>addslashes</function> example</title>
<programlisting role="php">
<refentry id="function.addslashes">
<refnamediv>
<refname>addslashes</refname>
<refpurpose>Quote string with slashes</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>addslashes</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string with backslashes before characters that need
to be quoted in database queries etc. These characters are
single quote (<literal>'</literal>), double quote
(<literal>"</literal>), backslash (<literal>\</literal>)
and NUL (the &null; byte).
</para>
<para>
An example use of <function>addslashes</function> is when you're
entering data into a database. For example, to insert the name
<literal>O'reilly</literal> into a database, you will need to escape
it. Most databases do this with a <literal>\</literal> which would
mean <literal>O\'reilly</literal>. This would only be to get the data
into the database, the extra <literal>\</literal> will not be inserted.
Having the PHP directive <link linkend="ini.magic-quotes-sybase">
magic_quotes_sybase</link> set to <literal>on</literal> will mean
<literal>'</literal> is instead escaped with another
<literal>'</literal>.
</para>
<para>
The PHP directive <link linkend="ini.magic-quotes-gpc">
magic_quotes_gpc</link> is <literal>on</literal> by default, and it
essentially runs <function>addslashes</function> on all GET, POST,
and COOKIE data. Do not use <function>addslashes</function> on
strings that have already been escaped with
<link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> as you'll
then do double escaping. The function
<function>get_magic_quotes_gpc</function> may come in handy for
checking this.
</para>
<para>
<example>
<title>An <function>addslashes</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$str = "Is your name O'reilly?";
@ -54,19 +54,19 @@ $str = "Is your name O'reilly?";
echo addslashes($str);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>stripslashes</function>,
<function>stripcslashes</function>,
<function>addcslashes</function>,
<function>htmlspecialchars</function>,
<function>quotemeta</function>, and
<function>get_magic_quotes_gpc</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>stripslashes</function>,
<function>stripcslashes</function>,
<function>addcslashes</function>,
<function>htmlspecialchars</function>,
<function>quotemeta</function>, and
<function>get_magic_quotes_gpc</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,29 +1,27 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.bin2hex">
<refnamediv>
<refname>bin2hex</refname>
<refpurpose>
Convert binary data into hexadecimal representation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>bin2hex</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns an ASCII string containing the hexadecimal representation
of <parameter>str</parameter>. The conversion is done byte-wise
with the high-nibble first.
</para>
<para>
See also <function>pack</function> and <function>unpack</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.bin2hex">
<refnamediv>
<refname>bin2hex</refname>
<refpurpose>Convert binary data into hexadecimal representation</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>bin2hex</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns an ASCII string containing the hexadecimal representation
of <parameter>str</parameter>. The conversion is done byte-wise
with the high-nibble first.
</para>
<para>
See also <function>pack</function> and <function>unpack</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.chr">
<refnamediv>
<refname>chr</refname>
<refpurpose>Return a specific character</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>chr</methodname>
<methodparam><type>int</type><parameter>ascii</parameter></methodparam>
</methodsynopsis>
<para>
Returns a one-character string containing the character specified
by <parameter>ascii</parameter>.
<example>
<title><function>chr</function> example</title>
<programlisting role="php">
<refentry id="function.chr">
<refnamediv>
<refname>chr</refname>
<refpurpose>Return a specific character</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>chr</methodname>
<methodparam><type>int</type><parameter>ascii</parameter></methodparam>
</methodsynopsis>
<para>
Returns a one-character string containing the character specified
by <parameter>ascii</parameter>.
<example>
<title><function>chr</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$str = "The string ends in escape: ";
@ -28,20 +28,20 @@ $str .= chr(27); /* add an escape character at the end of $str */
$str = sprintf("The string ends in escape: %c", 27);
?>
]]>
</programlisting>
</example>
</para>
<para>
You can find an ASCII-table over here: <ulink url="&url.asciitable;"
>&url.asciitable;</ulink>.
</para>
<para>
This function complements <function>ord</function>. See also
<function>sprintf</function> with a format string of
<literal>%c</literal>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
You can find an ASCII-table over here: <ulink url="&url.asciitable;"
>&url.asciitable;</ulink>.
</para>
<para>
This function complements <function>ord</function>. See also
<function>sprintf</function> with a format string of
<literal>%c</literal>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,45 +1,45 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.chunk-split">
<refnamediv>
<refname>chunk_split</refname>
<refpurpose>Split a string into smaller chunks</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>chunk_split</methodname>
<methodparam><type>string</type><parameter>body</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>chunklen</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>end</parameter></methodparam>
</methodsynopsis>
<para>
Can be used to split a string into smaller chunks which is useful for
e.g. converting <function>base64_encode</function> output to match RFC
2045 semantics. It inserts <parameter>end</parameter> (defaults to
"\r\n") every <parameter>chunklen</parameter> characters (defaults to
76). It returns the new string leaving the original string untouched.
<example>
<title><function>chunk_split</function> example</title>
<programlisting role="php">
<refentry id="function.chunk-split">
<refnamediv>
<refname>chunk_split</refname>
<refpurpose>Split a string into smaller chunks</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>chunk_split</methodname>
<methodparam><type>string</type><parameter>body</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>chunklen</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>end</parameter></methodparam>
</methodsynopsis>
<para>
Can be used to split a string into smaller chunks which is useful for
e.g. converting <function>base64_encode</function> output to match RFC
2045 semantics. It inserts <parameter>end</parameter> (defaults to
"\r\n") every <parameter>chunklen</parameter> characters (defaults to
76). It returns the new string leaving the original string untouched.
<example>
<title><function>chunk_split</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// format $data using RFC 2045 semantics
$new_string = chunk_split(base64_encode($data));
?>
]]>
</programlisting>
</example>
</para>
<simpara>
See also <function>str_split</function>,
<function>explode</function>, <function>split</function>,
<function>wordwrap</function> and
<ulink url="&url.rfc;2045">RFC 2045</ulink>.
</simpara>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<simpara>
See also <function>str_split</function>,
<function>explode</function>, <function>split</function>,
<function>wordwrap</function> and
<ulink url="&url.rfc;2045">RFC 2045</ulink>.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,64 +1,62 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.convert-cyr-string">
<refnamediv>
<refname>convert_cyr_string</refname>
<refpurpose>
Convert from one Cyrillic character set to another
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>convert_cyr_string</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>string</type><parameter>from</parameter></methodparam>
<methodparam><type>string</type><parameter>to</parameter></methodparam>
</methodsynopsis>
<para>
This function returns the given string converted from one
Cyrillic character set to another. The <parameter>from</parameter>
and <parameter>to</parameter> arguments are single characters that
represent the source and target Cyrillic character sets. The
supported types are:
<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>
<refentry id="function.convert-cyr-string">
<refnamediv>
<refname>convert_cyr_string</refname>
<refpurpose>Convert from one Cyrillic character set to another</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>convert_cyr_string</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam><type>string</type><parameter>from</parameter></methodparam>
<methodparam><type>string</type><parameter>to</parameter></methodparam>
</methodsynopsis>
<para>
This function returns the given string converted from one
Cyrillic character set to another. The <parameter>from</parameter>
and <parameter>to</parameter> arguments are single characters that
represent the source and target Cyrillic character sets. The
supported types are:
<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>
&note.bin-safe;
</refsect1>
</refentry>
&note.bin-safe;
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,11 +1,9 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.convert-uudecode">
<refnamediv>
<refname>convert_uudecode</refname>
<refpurpose>
Decode a uuencoded string
</refpurpose>
<refpurpose>Decode a uuencoded string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>

View file

@ -1,11 +1,9 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.convert-uuencode">
<refnamediv>
<refname>convert_uuencode</refname>
<refpurpose>
Uuencode a string
</refpurpose>
<refpurpose>Uuencode a string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>

View file

@ -1,61 +1,59 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.4 -->
<refentry id="function.count-chars">
<refnamediv>
<refname>count_chars</refname>
<refpurpose>
Return information about characters used in a string
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>count_chars</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
Counts the number of occurrences of every byte-value (0..255) in
<parameter>string</parameter> and returns it in various ways.
The optional parameter <parameter>mode</parameter> defaults to
0. Depending on <parameter>mode</parameter>
<function>count_chars</function> returns one of the following:
<itemizedlist>
<listitem>
<simpara>
0 - an array with the byte-value as key and the frequency of
every byte as value.
</simpara>
</listitem>
<listitem>
<simpara>
1 - same as 0 but only byte-values with a frequency greater
than zero are listed.
</simpara>
</listitem>
<listitem>
<simpara>
2 - same as 0 but only byte-values with a frequency equal to
zero are listed.
</simpara>
</listitem>
<listitem>
<simpara>
3 - a string containing all used byte-values is returned.
</simpara>
</listitem>
<listitem>
<simpara>
4 - a string containing all not used byte-values is returned.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>count_chars</function> example</title>
<programlisting role="php">
<refentry id="function.count-chars">
<refnamediv>
<refname>count_chars</refname>
<refpurpose>Return information about characters used in a string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>count_chars</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
Counts the number of occurrences of every byte-value (0..255) in
<parameter>string</parameter> and returns it in various ways.
The optional parameter <parameter>mode</parameter> defaults to
0. Depending on <parameter>mode</parameter>
<function>count_chars</function> returns one of the following:
<itemizedlist>
<listitem>
<simpara>
0 - an array with the byte-value as key and the frequency of
every byte as value.
</simpara>
</listitem>
<listitem>
<simpara>
1 - same as 0 but only byte-values with a frequency greater
than zero are listed.
</simpara>
</listitem>
<listitem>
<simpara>
2 - same as 0 but only byte-values with a frequency equal to
zero are listed.
</simpara>
</listitem>
<listitem>
<simpara>
3 - a string containing all used byte-values is returned.
</simpara>
</listitem>
<listitem>
<simpara>
4 - a string containing all not used byte-values is returned.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>count_chars</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$data = "Two Ts and one F.";
@ -65,31 +63,31 @@ foreach (count_chars($data, 1) as $i => $val) {
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
There were 4 instance(s) of " " in the string.
There were 1 instance(s) of "." in the string.
There were 1 instance(s) of "F" in the string.
There were 2 instance(s) of "T" in the string.
There were 1 instance(s) of "a" in the string.
There were 1 instance(s) of "d" in the string.
There were 1 instance(s) of "e" in the string.
There were 2 instance(s) of "n" in the string.
There were 2 instance(s) of "o" in the string.
There were 1 instance(s) of "s" in the string.
There were 1 instance(s) of "w" in the string.
There were 4 instance(s) of " " in the string.
There were 1 instance(s) of "." in the string.
There were 1 instance(s) of "F" in the string.
There were 2 instance(s) of "T" in the string.
There were 1 instance(s) of "a" in the string.
There were 1 instance(s) of "d" in the string.
There were 1 instance(s) of "e" in the string.
There were 2 instance(s) of "n" in the string.
There were 2 instance(s) of "o" in the string.
There were 1 instance(s) of "s" in the string.
There were 1 instance(s) of "w" in the string.
]]>
</screen>
</example>
</para>
<simpara>
See also <function>strpos</function> and
<function>substr_count</function>.
</simpara>
</refsect1>
</refentry>
</screen>
</example>
</para>
<simpara>
See also <function>strpos</function> and
<function>substr_count</function>.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.37 -->
<refentry id="function.crc32">
<refnamediv>
<refname>crc32</refname>
<refpurpose>Calculates the crc32 polynomial of a string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>crc32</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Generates the cyclic redundancy checksum polynomial of 32-bit
lengths of the <parameter>str</parameter>. This is usually used
to validate the integrity of data being transmitted.
</para>
<para>
Because PHP's integer type is signed, and many crc32 checksums will
result in negative integers, you need to use the "%u" formatter of
<function>sprintf</function> or <function>printf</function> to get
the string representation of the unsigned crc32 checksum.
</para>
<para>
This second example shows how to print a converted checksum with the
<function>printf</function> function:
<example>
<title>Displaying a crc32 checksum</title>
<programlisting role="php">
<refentry id="function.crc32">
<refnamediv>
<refname>crc32</refname>
<refpurpose>Calculates the crc32 polynomial of a string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>crc32</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Generates the cyclic redundancy checksum polynomial of 32-bit
lengths of the <parameter>str</parameter>. This is usually used
to validate the integrity of data being transmitted.
</para>
<para>
Because PHP's integer type is signed, and many crc32 checksums will
result in negative integers, you need to use the "%u" formatter of
<function>sprintf</function> or <function>printf</function> to get
the string representation of the unsigned crc32 checksum.
</para>
<para>
This second example shows how to print a converted checksum with the
<function>printf</function> function:
<example>
<title>Displaying a crc32 checksum</title>
<programlisting role="php">
<![CDATA[
<?php
$checksum = crc32("The quick brown fox jumped over the lazy dog.");
printf("%u\n", $checksum);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>md5</function> and <function>sha1</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>md5</function> and <function>sha1</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,93 +1,93 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.crypt">
<refnamediv>
<refname>crypt</refname>
<refpurpose>One-way string encryption (hashing)</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>crypt</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>salt</parameter></methodparam>
</methodsynopsis>
<para>
<function>crypt</function> will return an encrypted string using the
standard Unix <abbrev>DES</abbrev>-based encryption algorithm or
alternative algorithms that may be available on the system. Arguments
are a string to be encrypted and an optional salt string to base the
encryption on. See the Unix man page for your crypt function for more
information.
</para>
<refentry id="function.crypt">
<refnamediv>
<refname>crypt</refname>
<refpurpose>One-way string encryption (hashing)</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>crypt</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>salt</parameter></methodparam>
</methodsynopsis>
<para>
<function>crypt</function> will return an encrypted string using the
standard Unix <abbrev>DES</abbrev>-based encryption algorithm or
alternative algorithms that may be available on the system. Arguments
are a string to be encrypted and an optional salt string to base the
encryption on. See the Unix man page for your crypt function for more
information.
</para>
<simpara>
If the salt argument is not provided, one will be randomly
generated by PHP each time you call this function.
</simpara>
<simpara>
Some operating systems support more than one type of encryption. In
fact, sometimes the standard DES-based encryption is replaced by an
MD5-based encryption algorithm. The encryption type is triggered by the
salt argument. At install time, PHP determines the capabilities of the
crypt function and will accept salts for other encryption types. If no
salt is provided, PHP will auto-generate a standard two character salt by
default, unless the default encryption type on the system is MD5, in
which case a random MD5-compatible salt is generated. PHP sets a
constant named CRYPT_SALT_LENGTH which tells you whether a regular two
character salt applies to your system or the longer twelve character salt
is applicable.
</simpara>
<simpara>
If you are using the supplied salt, you should be aware that the salt is
generated once. If you are calling this function repeatedly, this may
impact both appearance and security.
</simpara>
<simpara>
The standard DES-based encryption <function>crypt</function> returns the
salt as the first two characters of the output. It also only uses the
first eight characters of <parameter>str</parameter>, so longer strings
that start with the same eight characters will generate the same result
(when the same salt is used).
</simpara>
<simpara>
On systems where the crypt() function supports multiple
encryption types, the following constants are set to 0 or 1
depending on whether the given type is available:
</simpara>
<itemizedlist>
<listitem>
<simpara>
If the salt argument is not provided, one will be randomly
generated by PHP each time you call this function.
CRYPT_STD_DES - Standard DES-based encryption with a two character salt
</simpara>
</listitem>
<listitem>
<simpara>
Some operating systems support more than one type of encryption. In
fact, sometimes the standard DES-based encryption is replaced by an
MD5-based encryption algorithm. The encryption type is triggered by the
salt argument. At install time, PHP determines the capabilities of the
crypt function and will accept salts for other encryption types. If no
salt is provided, PHP will auto-generate a standard two character salt by
default, unless the default encryption type on the system is MD5, in
which case a random MD5-compatible salt is generated. PHP sets a
constant named CRYPT_SALT_LENGTH which tells you whether a regular two
character salt applies to your system or the longer twelve character salt
is applicable.
CRYPT_EXT_DES - Extended DES-based encryption with a nine character salt
</simpara>
</listitem>
<listitem>
<simpara>
If you are using the supplied salt, you should be aware that the salt is
generated once. If you are calling this function repeatedly, this may
impact both appearance and security.
CRYPT_MD5 - MD5 encryption with a twelve character salt starting with
$1$
</simpara>
</listitem>
<listitem>
<simpara>
The standard DES-based encryption <function>crypt</function> returns the
salt as the first two characters of the output. It also only uses the
first eight characters of <parameter>str</parameter>, so longer strings
that start with the same eight characters will generate the same result
(when the same salt is used).
CRYPT_BLOWFISH - Blowfish encryption with a sixteen character salt
starting with $2$ or $2a$
</simpara>
<simpara>
On systems where the crypt() function supports multiple
encryption types, the following constants are set to 0 or 1
depending on whether the given type is available:
</simpara>
<itemizedlist>
<listitem>
<simpara>
CRYPT_STD_DES - Standard DES-based encryption with a two character salt
</simpara>
</listitem>
<listitem>
<simpara>
CRYPT_EXT_DES - Extended DES-based encryption with a nine character salt
</simpara>
</listitem>
<listitem>
<simpara>
CRYPT_MD5 - MD5 encryption with a twelve character salt starting with
$1$
</simpara>
</listitem>
<listitem>
<simpara>
CRYPT_BLOWFISH - Blowfish encryption with a sixteen character salt
starting with $2$ or $2a$
</simpara>
</listitem>
</itemizedlist>
<note>
<simpara>
There is no decrypt function, since <function>crypt</function>
uses a one-way algorithm.
</simpara>
</note>
<example>
<title><function>crypt</function> examples</title>
<programlisting role="php">
</listitem>
</itemizedlist>
<note>
<simpara>
There is no decrypt function, since <function>crypt</function>
uses a one-way algorithm.
</simpara>
</note>
<example>
<title><function>crypt</function> examples</title>
<programlisting role="php">
<![CDATA[
<?php
$password = crypt('mypassword'); // let the salt be automatically generated
@ -101,11 +101,11 @@ if (crypt($user_input, $password) == $password) {
}
?>
]]>
</programlisting>
</example>
<example>
<title>Using <function>crypt</function> with htpasswd</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>Using <function>crypt</function> with htpasswd</title>
<programlisting role="php">
<![CDATA[
<?php
// Set the password
@ -115,11 +115,11 @@ $password = 'mypassword';
$hash = crypt($password);
?>
]]>
</programlisting>
</example>
<example>
<title>Using <function>crypt</function> with different encryption types</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>Using <function>crypt</function> with different encryption types</title>
<programlisting role="php">
<![CDATA[
<?php
if (CRYPT_STD_DES == 1) {
@ -139,23 +139,23 @@ if (CRYPT_BLOWFISH == 1) {
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Standard DES: rl.3StKT.4T8M
Extended DES: _J9..rasmBYk8r9AiWNc
MD5: $1$rasmusle$rISCgZzpwk3UhDidwXvin0
Blowfish: $2a$07$rasmuslerd............nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra
]]>
</screen>
</example>
<simpara>
See also <function>md5</function> and <link linkend="ref.mcrypt">the
Mcrypt extension</link>.
</simpara>
</refsect1>
</refentry>
</screen>
</example>
<simpara>
See also <function>md5</function> and <link linkend="ref.mcrypt">the
Mcrypt extension</link>.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: