mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Restructuring partintros
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@72714 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9eca9363cf
commit
3634675e0d
8 changed files with 619 additions and 530 deletions
|
@ -1,25 +1,66 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.161 $ -->
|
||||
<!-- $Revision: 1.162 $ -->
|
||||
<reference id="ref.array">
|
||||
<title>Array Functions</title>
|
||||
<titleabbrev>Arrays</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<simpara>
|
||||
<para id="array.intro">
|
||||
These functions allow you to interact with and manipulate
|
||||
arrays in various ways. Arrays are essential for storing,
|
||||
managing, and operating on sets of variables.
|
||||
</simpara>
|
||||
<simpara>
|
||||
</para>
|
||||
<para>
|
||||
Simple and multi-dimensional arrays are supported, and may be
|
||||
either user created or created by another function.
|
||||
There are specific database handling functions for populating
|
||||
arrays from database queries, and several functions return arrays.
|
||||
</simpara>
|
||||
<para>
|
||||
Please see the <link linkend="language.types.array">Arrays</link>
|
||||
section of the manual for a detailed explanation of how arrays are
|
||||
implemented and used in PHP.
|
||||
</para>
|
||||
</para>
|
||||
<para>
|
||||
Please see the <link linkend="language.types.array">Arrays</link>
|
||||
section of the manual for a detailed explanation of how arrays are
|
||||
implemented and used in PHP.
|
||||
</para>
|
||||
|
||||
<section id="array.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
These functions are available as part of the standard module, which is
|
||||
always available.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="array.installation">
|
||||
<title>Installation</title>
|
||||
<para>
|
||||
There is no installation needed to use these functions, they are part of
|
||||
the PHP core.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="array.configuration">
|
||||
<title>Runtime Configuration</title>
|
||||
<para>
|
||||
This extension does not define any configuration directives.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="array.resources">
|
||||
<title>Resource types</title>
|
||||
<para>
|
||||
This extension does not define any resource types.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="array.constants">
|
||||
<title>Predefined constants</title>
|
||||
<para>
|
||||
<constant>CASE_UPPER</constant> and <constant>CASE_LOWER</constant> are
|
||||
used with the <function>array_change_key_case</function> function. They
|
||||
respectively are used for chaning a string to upper case or lower case.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<para>
|
||||
See also <function>is_array</function>, <function>explode</function>,
|
||||
<function>implode</function>, <function>split</function>,
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.22 $ -->
|
||||
<!-- $Revision: 1.23 $ -->
|
||||
<reference id="ref.bc">
|
||||
<title>BCMath Arbitrary Precision Mathematics Functions</title>
|
||||
<titleabbrev>BC math</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<para>
|
||||
<para id="bc.intro">
|
||||
For arbitrary precision mathematics PHP offers the Binary Calculator which
|
||||
supports numbers of any size and precision, represented as strings.
|
||||
</para>
|
||||
<para>
|
||||
In PHP 4, these functions are only available if PHP was configured with
|
||||
<link linkend="install.configure.enable-bcmath"><option role="configure">--enable-bcmath</option></link>.
|
||||
In PHP 3, these functions are only available if PHP was not configured with
|
||||
<link linkend="install.configure.disable-bcmath"><option role="configure">--disable-bcmath</option></link>.
|
||||
</para>
|
||||
<note>
|
||||
|
||||
<section id="bc.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
Due to changes in the licensing, the BCMATH library is distributed
|
||||
separate from the standard PHP source distribution.
|
||||
|
@ -24,7 +20,38 @@
|
|||
file <filename>README.BCMATH</filename> in the PHP distribution
|
||||
for more information.
|
||||
</para>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
<section id="bc.installation">
|
||||
<title>Installation</title>
|
||||
<para>
|
||||
In PHP 4, these functions are only available if PHP was configured with
|
||||
<link linkend="install.configure.enable-bcmath"><option role="configure">--enable-bcmath</option></link>.
|
||||
In PHP 3, these functions are only available if PHP was not configured with
|
||||
<link linkend="install.configure.disable-bcmath"><option role="configure">--disable-bcmath</option></link>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bc.configuration">
|
||||
<title>Runtime Configuration</title>
|
||||
<para>
|
||||
This extension does not define any configuration directives.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bc.resources">
|
||||
<title>Resource types</title>
|
||||
<para>
|
||||
This extension does not define any resource types.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bc.constants">
|
||||
<title>Predefined constants</title>
|
||||
<para>
|
||||
This extension does not define any constants.
|
||||
</para>
|
||||
</section>
|
||||
</partintro>
|
||||
|
||||
<refentry id="function.bcadd">
|
||||
|
|
|
@ -1,23 +1,56 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<reference id="ref.bzip2">
|
||||
<title>Bzip2 Compression Functions</title>
|
||||
<titleabbrev>Bzip2</titleabbrev>
|
||||
<partintro>
|
||||
<para>
|
||||
This module uses the functions of the <ulink
|
||||
url="&url.bzip2;">bzip2</ulink> library by Julian Seward to
|
||||
transparently read and write bzip2 (.bz2) compressed files.
|
||||
</para>
|
||||
<para>
|
||||
Bzip2 support in PHP is not enabled by default. You will need to
|
||||
use the <link linkend="install.configure.with-bz2">--with-bz2</link> configuration
|
||||
option when compiling PHP to enable bzip2 support. This module
|
||||
requires bzip2/libbzip2 version >= 1.0.x.
|
||||
</para>
|
||||
|
||||
<sect1 id="bzip2-example">
|
||||
<title>Small code example</title>
|
||||
<partintro>
|
||||
<para id="bzip2.intro">
|
||||
The bzip2 functions are used to transparently read and write bzip2 (.bz2)
|
||||
compressed files.
|
||||
</para>
|
||||
|
||||
<section id="bzip2.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
This module uses the functions of the <ulink
|
||||
url="&url.bzip2;">bzip2</ulink> library by Julian Seward
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bzip2.installation">
|
||||
<title>Installation</title>
|
||||
<para>
|
||||
Bzip2 support in PHP is not enabled by default. You will need to
|
||||
use the <link linkend="install.configure.with-bz2">--with-bz2</link> configuration
|
||||
option when compiling PHP to enable bzip2 support. This module
|
||||
requires bzip2/libbzip2 version >= 1.0.x.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bzip2.configuration">
|
||||
<title>Runtime Configuration</title>
|
||||
<para>
|
||||
This extension does not define any configuration directives.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bzip2.resources">
|
||||
<title>Resource types</title>
|
||||
<para>
|
||||
This extension does not define any resource types.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bzip2.constants">
|
||||
<title>Predefined constants</title>
|
||||
<para>
|
||||
This extension does not define any constants.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bzip2.examples">
|
||||
<title>Example</title>
|
||||
<para>
|
||||
This example opens a temporary file and writes a test string to
|
||||
it, then prints out the contents of the file.
|
||||
|
@ -55,7 +88,7 @@ bzclose($bz);
|
|||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
</section>
|
||||
</partintro>
|
||||
|
||||
|
||||
|
|
|
@ -1,29 +1,60 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<reference id="ref.crack">
|
||||
<title>Crack functions</title>
|
||||
<titleabbrev>Crack functions</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<simpara>
|
||||
These functions allow you to use the CrackLib library to test the 'strength'
|
||||
of a password. In order to use these functions, you must compile PHP with
|
||||
Crack support by using the <option role="configure">--with-crack[=DIR]</option>
|
||||
option.
|
||||
</simpara>
|
||||
<simpara>
|
||||
More information regarding CrackLib along with the library can be found at
|
||||
<ulink url="&url.crack;">&url.crack;</ulink>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Cracklib is useful in testing the 'strength' of a password that checks
|
||||
length, use of upper and lower case and a check against the specified CrackLib
|
||||
dictionary. CrackLib will also give helpful diagnostic messages that will
|
||||
help 'strengthen' the password.
|
||||
</simpara>
|
||||
<para id="crack.intro">
|
||||
These functions allow you to use the CrackLib library to test the
|
||||
'strength' of a password. The 'strength' of a password is tested by that
|
||||
checks length, use of upper and lower case and checked against the
|
||||
specified CrackLib dictionary. CrackLib will also give helpful diagnostic
|
||||
messages that will help 'strengthen' the password.
|
||||
</para>
|
||||
|
||||
<section id="crack.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
This example shows how to open a CrackLib dictionary, test a given password,
|
||||
retrieve any diagnostic messages, and close the dictionary.
|
||||
More information regarding CrackLib along with the library can be found at
|
||||
<ulink url="&url.crack;">&url.crack;</ulink>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="crack.installation">
|
||||
<title>Installation</title>
|
||||
<para>
|
||||
In order to use these functions, you must compile PHP with Crack support
|
||||
by using the <option role="configure">--with-crack[=DIR]</option> option.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="crack.configuration">
|
||||
<title>Runtime Configuration</title>
|
||||
<para>
|
||||
This extension does not define any configuration directives.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="crack.resources">
|
||||
<title>Resource types</title>
|
||||
<para>
|
||||
This extension does not define any resource types.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="crack.constants">
|
||||
<title>Predefined constants</title>
|
||||
<para>
|
||||
This extension does not define any constants.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="crack.examples">
|
||||
<title>Example</title>
|
||||
<para>
|
||||
This example shows how to open a CrackLib dictionary, test a given
|
||||
password, retrieve any diagnostic messages, and close the dictionary.
|
||||
<example>
|
||||
<title>CrackLib example</title>
|
||||
<programlisting role="php">
|
||||
|
@ -55,7 +86,6 @@ crack_closedict($dictionary);
|
|||
</note>
|
||||
</partintro>
|
||||
|
||||
|
||||
<refentry id="function.crack-opendict">
|
||||
<refnamediv>
|
||||
<refname>crack_opendict</refname>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.21 $ -->
|
||||
<!-- $Revision: 1.22 $ -->
|
||||
<reference id="ref.ctype">
|
||||
<title>Character type functions</title>
|
||||
<titleabbrev>ctype</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<para id="ctype.intro">
|
||||
The functions provided by this extension check whether a character
|
||||
or string falls into a certain character class according to the
|
||||
|
@ -26,7 +25,7 @@
|
|||
return &false; immediately.
|
||||
</para>
|
||||
|
||||
<section id="ctype.requirenments">
|
||||
<section id="ctype.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
None besides functions from the standard C library which are
|
||||
|
|
|
@ -1,36 +1,17 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.28 $ -->
|
||||
<!-- $Revision: 1.29 $ -->
|
||||
<reference id="ref.mcrypt">
|
||||
<title>Mcrypt Encryption Functions</title>
|
||||
<titleabbrev>mcrypt</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<para>
|
||||
These functions work using <ulink
|
||||
url="&url.mcrypt;">mcrypt</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
<para id="mcrypt.intro">
|
||||
This is an interface to the mcrypt library, which supports a wide
|
||||
variety of block algorithms such as DES, TripleDES, Blowfish
|
||||
(default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and
|
||||
GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it
|
||||
supports RC6 and IDEA which are considered "non-free".
|
||||
</para>
|
||||
<para>
|
||||
If you linked against libmcrypt 2.4.x, the following additional
|
||||
block algorithms are supported: CAST, LOKI97, RIJNDAEL, SAFERPLUS,
|
||||
SERPENT and the following stream ciphers: ENIGMA (crypt), PANAMA,
|
||||
RC4 and WAKE. With libmcrypt 2.4.x another cipher mode is also
|
||||
available; nOFB.
|
||||
</para>
|
||||
<para>
|
||||
To use it, download libmcrypt-x.x.tar.gz from <ulink
|
||||
url="&url.mcrypt;">here</ulink> and follow the included
|
||||
installation instructions. You need to compile PHP with the
|
||||
<option role="configure">--with-mcrypt</option> parameter to
|
||||
enable this extension. Make sure you compile libmcrypt with the
|
||||
option <option role="configure">--disable-posix-threads</option>.
|
||||
</para>
|
||||
<para>
|
||||
Mcrypt can be used to encrypt and decrypt using the above
|
||||
mentioned ciphers. If you linked against libmcrypt-2.2.x, the
|
||||
|
@ -77,295 +58,166 @@ mcrypt_generic_end ($td);
|
|||
This example will give you the encrypted data as a string in
|
||||
<literal>$encrypted_data</literal>.
|
||||
</para>
|
||||
<para>
|
||||
Mcrypt can operate in four block cipher modes (CBC, OFB, CFB, and
|
||||
ECB). If linked against libmcrypt-2.4.x mcrypt can also operate
|
||||
in the block cipher mode nOFB and in STREAM mode. Then there are
|
||||
also constants in the form MCRYPT_MODE_mode for use with several
|
||||
functions. We will outline the normal use for each of these modes.
|
||||
For a more complete reference and discussion see
|
||||
&book.applied.cryptography;.
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
ECB (electronic codebook) is suitable for random data, such as
|
||||
encrypting other keys. Since data there is short and random,
|
||||
the disadvantages of ECB have a favorable negative
|
||||
effect.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
CBC (cipher block chaining) is especially suitable for
|
||||
encrypting files where the security is increased over ECB
|
||||
significantly.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
CFB (cipher feedback) is the best mode for encrypting byte
|
||||
streams where single bytes must be encrypted.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
OFB (output feedback, in 8bit) is comparable to CFB, but
|
||||
can be used in applications where error propagation cannot
|
||||
be tolerated. It's insecure (because it operates in 8bit
|
||||
mode) so it is not recommended to use it.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
nOFB (output feedback, in nbit) is comparable to OFB, but
|
||||
more secure because it operates on the block size of the
|
||||
algorithm.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
STREAM is an extra mode to include some stream algorithms
|
||||
like WAKE or RC4.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
PHP does not support encrypting/decrypting bit streams
|
||||
currently. As of now, PHP only supports handling of strings.
|
||||
</para>
|
||||
<para>
|
||||
For a complete list of supported ciphers, see the defines at the
|
||||
end of <filename>mcrypt.h</filename>. The general rule with the
|
||||
mcrypt-2.2.x API is that you can access the cipher from PHP with
|
||||
MCRYPT_ciphername. With the mcrypt-2.4.x API these constants also
|
||||
work, but it is possible to specify the name of the cipher as
|
||||
a string with a call to <function>mcrypt_module_open</function>.
|
||||
</para>
|
||||
<para>
|
||||
Here is a short list of ciphers which are currently supported by
|
||||
the mcrypt extension. If a cipher is not listed here, but is
|
||||
listed by mcrypt as supported, you can safely assume that this
|
||||
documentation is outdated.
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_3DES
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_ARCFOUR_IV (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_ARCFOUR (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_BLOWFISH
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_CAST_128
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_CAST_256
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_CRYPT
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_DES
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_DES_COMPAT (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_ENIGMA (libmcrypt 2.4.x only, alias for MCRYPT_CRYPT)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_GOST
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_IDEA (non-free)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_LOKI97 (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_MARS (libmcrypt 2.4.x only, non-free)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_PANAMA (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RIJNDAEL_128 (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RIJNDAEL_192 (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RIJNDAEL_256 (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RC2
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RC4 (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RC6 (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RC6_128 (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RC6_192 (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_RC6_256 (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SAFER64
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SAFER128
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SAFERPLUS (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SERPENT (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SERPENT_128 (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SERPENT_192 (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SERPENT_256 (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_SKIPJACK (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_TEAN (libmcrypt 2.2.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_THREEWAY
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_TRIPLEDES (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_TWOFISH (for older mcrypt 2.x versions, or mcrypt 2.4.x )
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_TWOFISH128 (TWOFISHxxx are available in newer 2.x versions, but not in the 2.4.x versions)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_TWOFISH192
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_TWOFISH256
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_WAKE (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_XTEA (libmcrypt 2.4.x only)
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
You must (in CFB and OFB mode) or can (in CBC mode) supply an
|
||||
initialization vector (IV) to the respective cipher function. The
|
||||
IV must be unique and must be the same when
|
||||
decrypting/encrypting. With data which is stored encrypted, you
|
||||
can take the output of a function of the index under which the
|
||||
data is stored (e.g. the MD5 key of the filename).
|
||||
Alternatively, you can transmit the IV together with the encrypted
|
||||
data (see chapter 9.3 of &book.applied.cryptography; for a
|
||||
discussion of this topic).
|
||||
</para>
|
||||
|
||||
<section id="mcrypt.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
These functions work using <ulink
|
||||
url="&url.mcrypt;">mcrypt</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
If you linked against libmcrypt 2.4.x, the following additional
|
||||
block algorithms are supported: CAST, LOKI97, RIJNDAEL, SAFERPLUS,
|
||||
SERPENT and the following stream ciphers: ENIGMA (crypt), PANAMA,
|
||||
RC4 and WAKE. With libmcrypt 2.4.x another cipher mode is also
|
||||
available; nOFB.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mcrypt.installation">
|
||||
<title>Installation</title>
|
||||
<para>
|
||||
To use it, download libmcrypt-x.x.tar.gz from <ulink
|
||||
url="&url.mcrypt;">here</ulink> and follow the included
|
||||
installation instructions. You need to compile PHP with the
|
||||
<option role="configure">--with-mcrypt</option> parameter to
|
||||
enable this extension. Make sure you compile libmcrypt with the
|
||||
option <option role="configure">--disable-posix-threads</option>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mcrypt.configuration">
|
||||
<title>Runtime Configuration</title>
|
||||
<para>
|
||||
<!-- add configuration directives -->
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mcrypt.resources">
|
||||
<title>Resource types</title>
|
||||
<para>
|
||||
This extension does not define any resource types.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mcrypt.constants">
|
||||
<title>Predefined constants</title>
|
||||
|
||||
<para>
|
||||
Mcrypt can operate in four block cipher modes (CBC, OFB, CFB, and
|
||||
ECB). If linked against libmcrypt-2.4.x mcrypt can also operate
|
||||
in the block cipher mode nOFB and in STREAM mode. Below you find a list
|
||||
with all supported encryption modes together with the constants that are
|
||||
defines for the encryption mode. For a more complete reference and
|
||||
discussion see &book.applied.cryptography;.
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_MODE_ECB (electronic codebook) is suitable for random data,
|
||||
such as encrypting other keys. Since data there is short and random,
|
||||
the disadvantages of ECB have a favorable negative effect.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_MODE_CBC (cipher block chaining) is especially suitable for
|
||||
encrypting files where the security is increased over ECB
|
||||
significantly.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_MODE_CFB (cipher feedback) is the best mode for encrypting byte
|
||||
streams where single bytes must be encrypted.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_MODE_OFB (output feedback, in 8bit) is comparable to CFB, but
|
||||
can be used in applications where error propagation cannot
|
||||
be tolerated. It's insecure (because it operates in 8bit
|
||||
mode) so it is not recommended to use it.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_MODE_NOFB (output feedback, in nbit) is comparable to OFB, but
|
||||
more secure because it operates on the block size of the algorithm.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
MCRYPT_MODE_STREAM is an extra mode to include some stream algorithms
|
||||
like WAKE or RC4.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Here is a list of ciphers which are currently supported by the mcrypt
|
||||
extension. For a complete list of supported ciphers, see the defines at
|
||||
the end of <filename>mcrypt.h</filename>. The general rule with the
|
||||
mcrypt-2.2.x API is that you can access the cipher from PHP with
|
||||
MCRYPT_ciphername. With the mcrypt-2.4.x API these constants also work,
|
||||
but it is possible to specify the name of the cipher as a string with a
|
||||
call to <function>mcrypt_module_open</function>.
|
||||
<itemizedlist>
|
||||
<listitem><simpara>MCRYPT_3DES</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_ARCFOUR_IV (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_ARCFOUR (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_BLOWFISH</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_CAST_128</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_CAST_256</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_CRYPT</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_DES</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_DES_COMPAT (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_ENIGMA (libmcrypt 2.4.x only, alias for MCRYPT_CRYPT)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_GOST</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_IDEA (non-free)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_LOKI97 (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_MARS (libmcrypt 2.4.x only, non-free)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_PANAMA (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RIJNDAEL_128 (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RIJNDAEL_192 (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RIJNDAEL_256 (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RC2</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RC4 (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RC6 (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RC6_128 (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RC6_192 (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_RC6_256 (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SAFER64</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SAFER128</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SAFERPLUS (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SERPENT(libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SERPENT_128 (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SERPENT_192 (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SERPENT_256 (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_SKIPJACK (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_TEAN (libmcrypt 2.2.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_THREEWAY</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_TRIPLEDES (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_TWOFISH (for older mcrypt 2.x versions, or mcrypt 2.4.x )</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_TWOFISH128 (TWOFISHxxx are available in newer 2.x versions, but not in the 2.4.x versions)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_TWOFISH192</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_TWOFISH256</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_WAKE (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
<listitem><simpara>MCRYPT_XTEA (libmcrypt 2.4.x only)</simpara></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
You must (in CFB and OFB mode) or can (in CBC mode) supply an
|
||||
initialization vector (IV) to the respective cipher function. The
|
||||
IV must be unique and must be the same when
|
||||
decrypting/encrypting. With data which is stored encrypted, you
|
||||
can take the output of a function of the index under which the
|
||||
data is stored (e.g. the MD5 key of the filename).
|
||||
Alternatively, you can transmit the IV together with the encrypted
|
||||
data (see chapter 9.3 of &book.applied.cryptography; for a
|
||||
discussion of this topic).
|
||||
</para>
|
||||
</section>
|
||||
</partintro>
|
||||
|
||||
<refentry id="function.mcrypt-get-cipher-name">
|
||||
|
|
|
@ -1,126 +1,200 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.88 $ -->
|
||||
<!-- $Revision: 1.89 $ -->
|
||||
<reference id="ref.mysql">
|
||||
<title>MySQL Functions</title>
|
||||
<titleabbrev>MySQL</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<simpara>
|
||||
These functions allow you to access MySQL database servers. In
|
||||
order to have these functions available, you must compile PHP
|
||||
with MySQL support by using the
|
||||
<option role="configure">--with-mysql</option> option. If you
|
||||
use this option without specifying the path to MySQL, PHP will
|
||||
use the built-in MySQL client libraries. Users who run other
|
||||
applications that use MySQL (for example, running PHP 3 and PHP 4
|
||||
as concurrent apache modules, or auth-mysql) should always
|
||||
specify the path to MySQL:
|
||||
<option role="configure">--with-mysql=/path/to/mysql</option>.
|
||||
This will force PHP to use the client libraries installed by
|
||||
MySQL, avoiding any conflicts.
|
||||
</simpara>
|
||||
<simpara>
|
||||
<para id="mysql.intro">
|
||||
These functions allow you to access MySQL database servers.
|
||||
More information about MySQL can be found at <ulink
|
||||
url="&url.mysql;">&url.mysql;</ulink>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Documentation for MySQL can be found at <ulink
|
||||
url="&url.mysql.docs;">&url.mysql.docs;</ulink>.
|
||||
</simpara>
|
||||
<para>
|
||||
The behaviour of the MySQL functions is affected by settings in the global
|
||||
<link linkend="configuration">configuration</link> file.
|
||||
<table>
|
||||
<title><link linkend="ini.sect.mysql">MySQL Configuration </link> Options</title>
|
||||
<tgroup cols="3">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Changeable</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>mysql.allow_persistent</entry>
|
||||
<entry>"On"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.max_persistent</entry>
|
||||
<entry>"-1"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.max_links</entry>
|
||||
<entry>"-1"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_port</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_socket</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_host</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_user</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
For further details and definition of the PHP_INI_* constants see <function>ini_set</function>.
|
||||
</para>
|
||||
<para>
|
||||
This simple example shows how to connect, execute a query, print
|
||||
resulting rows and disconnect from a MySQL database.
|
||||
<example>
|
||||
<title>MySQL extension overview example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Connecting, selecting database
|
||||
$link = mysql_connect("mysql_host", "mysql_login", "mysql_password")
|
||||
or die("Could not connect");
|
||||
print "Connected successfully";
|
||||
mysql_select_db("my_database")
|
||||
or die("Could not select database");
|
||||
|
||||
// Performing SQL query
|
||||
$query = "SELECT * FROM my_table";
|
||||
$result = mysql_query($query)
|
||||
or die("Query failed");
|
||||
|
||||
// Printing results in HTML
|
||||
print "<table>\n";
|
||||
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
print "\t<tr>\n";
|
||||
foreach ($line as $col_value) {
|
||||
print "\t\t<td>$col_value</td>\n";
|
||||
}
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
// Free resultset
|
||||
mysql_free_result($result);
|
||||
|
||||
// Closing connection
|
||||
mysql_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
Documentation for MySQL can be found at <ulink
|
||||
url="&url.mysql.docs;">&url.mysql.docs;</ulink>.
|
||||
</para>
|
||||
|
||||
<section id="mysql.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
In order to have these functions available, you must compile PHP with
|
||||
MySQL support
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mysql.installation">
|
||||
<title>Installation</title>
|
||||
<para>
|
||||
By using the <option role="configure">--with-mysql</option> configuration
|
||||
option you enable PHP to access MySQL databases. If you use this option
|
||||
without specifying the path to MySQL, PHP will use the built-in MySQL
|
||||
client libraries. With PHP4 MySQL support is always eanbled; if you don't
|
||||
specify the configure option, the bundled libraries are used. Users who
|
||||
run other applications that use MySQL (for example, running PHP 3 and PHP
|
||||
4 as concurrent apache modules, or auth-mysql) should always specify the
|
||||
path to MySQL: <option
|
||||
role="configure">--with-mysql=/path/to/mysql</option>. This will force
|
||||
PHP to use the client libraries installed by MySQL, avoiding any
|
||||
conflicts.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mysql.configuration">
|
||||
<title>Runtime Configuration</title>
|
||||
<para>
|
||||
The behaviour of the MySQL functions is affected by settings in the
|
||||
global <link linkend="configuration">configuration</link> file.
|
||||
<table>
|
||||
<title><link linkend="ini.sect.mysql">MySQL Configuration</link> Options</title>
|
||||
<tgroup cols="3">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Changeable</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>mysql.allow_persistent</entry>
|
||||
<entry>"On"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.max_persistent</entry>
|
||||
<entry>"-1"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.max_links</entry>
|
||||
<entry>"-1"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_port</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_socket</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_host</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>mysql.default_user</entry>
|
||||
<entry>NULL</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
For further details and definition of the PHP_INI_* constants see
|
||||
<function>ini_set</function>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mysql.resources">
|
||||
<title>Resource types</title>
|
||||
<para>
|
||||
There are two resource types used in the MySQL module. The first one isis
|
||||
is the link identifier for a database connection, the second a resource
|
||||
which helds the result of a query.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mysql.constants">
|
||||
<title>Predefined constants</title>
|
||||
<para>
|
||||
The function <function>mysql_fetch_array</function> uses a constant for
|
||||
the different types of result arrays. The following constants are
|
||||
defined:
|
||||
<table>
|
||||
<title>ncurses color constants</title>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>constant</entry>
|
||||
<entry>meaning</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>MYSQL_ASSOC</entry>
|
||||
<entry>
|
||||
Columns are returned into the array having the fieldname as the array
|
||||
index.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>MYSQL_BOTH</entry>
|
||||
<entry>
|
||||
Columns are returned into the array having both a numerical index
|
||||
and the fieldname as the array index.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>MYSQL_NUM</entry>
|
||||
<entry>
|
||||
Columns are returned into the array having a numerical index to the
|
||||
fields. This index starts with 0, the first field in the result.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="mysql.examples">
|
||||
<title>Examples</title>
|
||||
<para>
|
||||
This simple example shows how to connect, execute a query, print
|
||||
resulting rows and disconnect from a MySQL database.
|
||||
<example>
|
||||
<title>MySQL extension overview example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Connecting, selecting database
|
||||
$link = mysql_connect("mysql_host", "mysql_login", "mysql_password")
|
||||
or die("Could not connect");
|
||||
print "Connected successfully";
|
||||
mysql_select_db("my_database")
|
||||
or die("Could not select database");
|
||||
|
||||
// Performing SQL query
|
||||
$query = "SELECT * FROM my_table";
|
||||
$result = mysql_query($query)
|
||||
or die("Query failed");
|
||||
|
||||
// Printing results in HTML
|
||||
print "<table>\n";
|
||||
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
print "\t<tr>\n";
|
||||
foreach ($line as $col_value) {
|
||||
print "\t\t<td>$col_value</td>\n";
|
||||
}
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
// Free resultset
|
||||
mysql_free_result($result);
|
||||
|
||||
// Closing connection
|
||||
mysql_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</section>
|
||||
</partintro>
|
||||
|
||||
<refentry id="function.mysql-affected-rows">
|
||||
|
@ -1877,7 +1951,7 @@ $result = mysql_query("SELECT my_col FROM my_tbl")
|
|||
execution.
|
||||
</para>
|
||||
<para>
|
||||
See also: <function>mysql_num_rows</function>
|
||||
See also: <function>mysql_num_rows</function>,
|
||||
<function>mysql_affected_rows</function>,
|
||||
<function>mysql_unbuffered_query</function>,
|
||||
<function>mysql_free_result</function>,
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.74 $ -->
|
||||
<!-- $Revision: 1.75 $ -->
|
||||
<reference id="ref.pcre">
|
||||
<title>Regular Expression Functions (Perl-Compatible)</title>
|
||||
<titleabbrev>PCRE</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<note>
|
||||
<para>
|
||||
PHP also supports regular expressions using a POSIX-extended syntax
|
||||
using the <link linkend="ref.regex">POSIX-extended regex functions.</link>.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<para id="pcre.intro">
|
||||
The syntax for patterns used in these functions closely resembles
|
||||
Perl. The expression should be enclosed in the delimiters, a
|
||||
forward slash (/), for example. Any character can be used for
|
||||
|
@ -26,50 +20,89 @@
|
|||
See <link linkend="pcre.pattern.modifiers">Pattern Modifiers</link>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Examples of valid patterns</title>
|
||||
<itemizedlist>
|
||||
<listitem><simpara>/<\/\w+>/</simpara></listitem>
|
||||
<listitem><simpara>|(\d{3})-\d+|Sm</simpara></listitem>
|
||||
<listitem><simpara>/^(?i)php[34]/</simpara></listitem>
|
||||
<listitem><simpara>{^\s+(\s+)?$}</simpara></listitem>
|
||||
</itemizedlist>
|
||||
</example>
|
||||
PHP also supports regular expressions using a POSIX-extended syntax
|
||||
using the <link linkend="ref.regex">POSIX-extended regex functions.</link>.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Examples of invalid patterns</title>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
/href='(.*)' - missing ending delimiter
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
/\w+\s*\w+/J - unknown modifier 'J'
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
1-\d3-\d3-\d4| - missing starting delimiter
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
The Perl-compatible regular expression functions are available in
|
||||
PHP 4 and in PHP 3.0.9 and up.
|
||||
</simpara>
|
||||
<simpara>
|
||||
|
||||
<section id="pcre.requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
Regular expression support is provided by the PCRE library
|
||||
package, which is open source software, written by Philip Hazel,
|
||||
and copyright by the University of Cambridge, England. It is
|
||||
available at <ulink url="&url.pcre;">&url.pcre;</ulink>.
|
||||
</simpara>
|
||||
</note>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="pcre.installation">
|
||||
<title>Installation</title>
|
||||
<para>
|
||||
Beginning with PHP 4.2.0 this function are enabled by default.
|
||||
For older versions you have to configure and compile PHP
|
||||
with <option role="configure">--with-pcre-regex[=DIR]</option> in order
|
||||
to use these functions. You can disable the pcre functions with <option
|
||||
role="configure">--without-pcre-regex</option>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="pcre.configuration">
|
||||
<title>Runtime Configuration</title>
|
||||
<para>
|
||||
This extension does not define any configuration directives.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="pcre.resources">
|
||||
<title>Resource types</title>
|
||||
<para>
|
||||
This extension does not define any resource types.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="pcre.constants">
|
||||
<title>Predefined constants</title>
|
||||
<para>
|
||||
This extension does not define any constants.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="pcre.examples">
|
||||
<title>Examples</title>
|
||||
<para>
|
||||
<example>
|
||||
<title>Examples of valid patterns</title>
|
||||
<itemizedlist>
|
||||
<listitem><simpara>/<\/\w+>/</simpara></listitem>
|
||||
<listitem><simpara>|(\d{3})-\d+|Sm</simpara></listitem>
|
||||
<listitem><simpara>/^(?i)php[34]/</simpara></listitem>
|
||||
<listitem><simpara>{^\s+(\s+)?$}</simpara></listitem>
|
||||
</itemizedlist>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Examples of invalid patterns</title>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
/href='(.*)' - missing ending delimiter
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
/\w+\s*\w+/J - unknown modifier 'J'
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
1-\d3-\d3-\d4| - missing starting delimiter
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</example>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</partintro>
|
||||
|
||||
<refentry id="function.preg-match">
|
||||
|
|
Loading…
Reference in a new issue