added description about function overload.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@72622 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Rui Hirokawa 2002-03-10 08:51:50 +00:00
parent 4dbe32f183
commit aafaa1fcd9

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.23 $ -->
<!-- $Revision: 1.24 $ -->
<reference id="ref.mbstring">
<title>Multi-Byte String Functions</title>
<titleabbrev>Multi-Byte String</titleabbrev>
@ -440,6 +440,109 @@ mbstring.substitute_character = none
</example>
</para>
</sect2>
<sect2 id="mb-overload">
<title>
Overload of PHP string functions by mbstring functions with
multibyte support
</title>
<para>
Because almost PHP application written for language using
single-byte character encoding, there are some difficulties for
multibyte string handling including japanese. Almost PHP string
functions such as <function>substr</function> do not support
multibyte string.
</para>
<para>
Multibyte extension (mbstring) has some PHP string functions
with multibyte support (ex. <function>substr</function> supports
<function>mb_substr</function>).
</para>
<para>
Multibyte extension (mbstring) also supports 'function
overloading' to add multibyte string functionality without
code modification. Using function overloading, some PHP string
functions will be oveloaded multibyte string functions.
For example, <function>mb_substr</function> is called
instead of <function>substr</function> if function overloading
is enabled. Function overload makes easy to port application
supporting only single-byte encoding for multibyte application.
</para>
<para>
<literal>mbstring.func_overload</literal> in php.ini should be
set some positive value to use function overloading.
The value should specify the category of overloading functions,
sbould be set 1 to enable mail function overloading. 2 to enable
string functions, 4 to regular expression functions. For
example, if is set for 7, mail, strings, regex functions should
be overloaded. The list of overloaded functions are shown in
below.
<table>
<title>Functions to be overloaded</title>
<tgroup cols="3">
<thead>
<row>
<entry>value of mbstring.func_overload</entry>
<entry>original function</entry>
<entry>overloaded function</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry><function>mail</function></entry>
<entry><function>mb_send_mail</function></entry>
</row>
<row>
<entry>2</entry>
<entry><function>strlen</function></entry>
<entry><function>mb_strlen</function></entry>
</row>
<row>
<entry>2</entry>
<entry><function>strpos</function></entry>
<entry><function>mb_strpos</function></entry>
</row>
<row>
<entry>2</entry>
<entry><function>strrpos</function></entry>
<entry><function>mb_strrpos</function></entry>
</row>
<row>
<entry>2</entry>
<entry><function>substr</function></entry>
<entry><function>mb_substr</function></entry>
</row>
<row>
<entry>4</entry>
<entry><function>ereg</function></entry>
<entry><function>mb_ereg</function></entry>
</row>
<row>
<entry>4</entry>
<entry><function>eregi</function></entry>
<entry><function>mb_eregi</function></entry>
</row>
<row>
<entry>4</entry>
<entry><function>ereg_replace</function></entry>
<entry><function>mb_ereg_replace</function></entry>
</row>
<row>
<entry>4</entry>
<entry><function>eregi_replace</function></entry>
<entry><function>mb_eregi_replace</function></entry>
</row>
<row>
<entry>4</entry>
<entry><function>split</function></entry>
<entry><function>mb_split</function></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</sect2>
<sect2 id="mb-ja-basic">
<title>Basics for Japanese multi-byte character</title>