/.vim/manuals/php/mbstring.overload.html

https://bitbucket.org/fally/configs · HTML · 155 lines · 135 code · 20 blank · 0 comment · 0 complexity · 41c1c23453c6f5ff046aa3d4022947ef MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>Function Overloading Feature</title>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  6. </head>
  7. <body><div style="text-align: center;">
  8. <div class="prev" style="text-align: left; float: left;"><a href="mbstring.supported-encodings.html">Supported Character Encodings</a></div>
  9. <div class="next" style="text-align: right; float: right;"><a href="mbstring.php4.req.html">PHP Character Encoding Requirements</a></div>
  10. <div class="up"><a href="book.mbstring.html">Multibyte String</a></div>
  11. <div class="home"><a href="index.html">PHP Manual</a></div>
  12. </div><hr /><div>
  13. <h1>
  14. Function Overloading Feature
  15. </h1>
  16. <p class="para">
  17. You might often find it difficult to get an existing PHP application
  18. to work in a given multibyte environment. This happens because most
  19. PHP applications out there are written with the standard string
  20. functions such as <a href="function.substr.html" class="function">substr()</a>, which are known to
  21. not properly handle multibyte-encoded strings.
  22. </p>
  23. <p class="para">
  24. mbstring supports a &#039;function overloading&#039; feature which enables
  25. you to add multibyte awareness to such an application without
  26. code modification by overloading multibyte counterparts on
  27. the standard string functions. For example,
  28. <a href="function.mb-substr.html" class="function">mb_substr()</a> is called instead of
  29. <a href="function.substr.html" class="function">substr()</a> if function overloading is enabled.
  30. This feature makes it easy to port applications that only support
  31. single-byte encodings to a multibyte environment in many cases.
  32. </p>
  33. <p class="para">
  34. To use function overloading, set
  35. <i>mbstring.func_overload</i> in <var class="filename">php.ini</var> to a
  36. positive value that represents a combination of bitmasks specifying
  37. the categories of functions to be overloaded. It should be set
  38. to 1 to overload the <a href="function.mail.html" class="function">mail()</a> function. 2 for string
  39. functions, 4 for regular expression functions. For example,
  40. if it is set to 7, mail, strings and regular expression functions will
  41. be overloaded. The list of overloaded functions are shown below.
  42. <table border="5">
  43. <caption><b>Functions to be overloaded</b></caption>
  44. <colgroup>
  45. <thead valign="middle">
  46. <tr valign="middle">
  47. <th colspan="1">value of mbstring.func_overload</th>
  48. <th colspan="1">original function</th>
  49. <th colspan="1">overloaded function</th>
  50. </tr>
  51. </thead>
  52. <tbody valign="middle" class="tbody">
  53. <tr valign="middle">
  54. <td colspan="1" rowspan="1" align="left">1</td>
  55. <td colspan="1" rowspan="1" align="left"><a href="function.mail.html" class="function">mail()</a></td>
  56. <td colspan="1" rowspan="1" align="left"><a href="function.mb-send-mail.html" class="function">mb_send_mail()</a></td>
  57. </tr>
  58. <tr valign="middle">
  59. <td colspan="1" rowspan="1" align="left">2</td>
  60. <td colspan="1" rowspan="1" align="left"><a href="function.strlen.html" class="function">strlen()</a></td>
  61. <td colspan="1" rowspan="1" align="left"><a href="function.mb-strlen.html" class="function">mb_strlen()</a></td>
  62. </tr>
  63. <tr valign="middle">
  64. <td colspan="1" rowspan="1" align="left">2</td>
  65. <td colspan="1" rowspan="1" align="left"><a href="function.strpos.html" class="function">strpos()</a></td>
  66. <td colspan="1" rowspan="1" align="left"><a href="function.mb-strpos.html" class="function">mb_strpos()</a></td>
  67. </tr>
  68. <tr valign="middle">
  69. <td colspan="1" rowspan="1" align="left">2</td>
  70. <td colspan="1" rowspan="1" align="left"><a href="function.strrpos.html" class="function">strrpos()</a></td>
  71. <td colspan="1" rowspan="1" align="left"><a href="function.mb-strrpos.html" class="function">mb_strrpos()</a></td>
  72. </tr>
  73. <tr valign="middle">
  74. <td colspan="1" rowspan="1" align="left">2</td>
  75. <td colspan="1" rowspan="1" align="left"><a href="function.substr.html" class="function">substr()</a></td>
  76. <td colspan="1" rowspan="1" align="left"><a href="function.mb-substr.html" class="function">mb_substr()</a></td>
  77. </tr>
  78. <tr valign="middle">
  79. <td colspan="1" rowspan="1" align="left">2</td>
  80. <td colspan="1" rowspan="1" align="left"><a href="function.strtolower.html" class="function">strtolower()</a></td>
  81. <td colspan="1" rowspan="1" align="left"><a href="function.mb-strtolower.html" class="function">mb_strtolower()</a></td>
  82. </tr>
  83. <tr valign="middle">
  84. <td colspan="1" rowspan="1" align="left">2</td>
  85. <td colspan="1" rowspan="1" align="left"><a href="function.strtoupper.html" class="function">strtoupper()</a></td>
  86. <td colspan="1" rowspan="1" align="left"><a href="function.mb-strtoupper.html" class="function">mb_strtoupper()</a></td>
  87. </tr>
  88. <tr valign="middle">
  89. <td colspan="1" rowspan="1" align="left">2</td>
  90. <td colspan="1" rowspan="1" align="left"><a href="function.substr-count.html" class="function">substr_count()</a></td>
  91. <td colspan="1" rowspan="1" align="left"><a href="function.mb-substr-count.html" class="function">mb_substr_count()</a></td>
  92. </tr>
  93. <tr valign="middle">
  94. <td colspan="1" rowspan="1" align="left">4</td>
  95. <td colspan="1" rowspan="1" align="left"><a href="function.ereg.html" class="function">ereg()</a></td>
  96. <td colspan="1" rowspan="1" align="left"><a href="function.mb-ereg.html" class="function">mb_ereg()</a></td>
  97. </tr>
  98. <tr valign="middle">
  99. <td colspan="1" rowspan="1" align="left">4</td>
  100. <td colspan="1" rowspan="1" align="left"><a href="function.eregi.html" class="function">eregi()</a></td>
  101. <td colspan="1" rowspan="1" align="left"><a href="function.mb-eregi.html" class="function">mb_eregi()</a></td>
  102. </tr>
  103. <tr valign="middle">
  104. <td colspan="1" rowspan="1" align="left">4</td>
  105. <td colspan="1" rowspan="1" align="left"><a href="function.ereg-replace.html" class="function">ereg_replace()</a></td>
  106. <td colspan="1" rowspan="1" align="left"><a href="function.mb-ereg-replace.html" class="function">mb_ereg_replace()</a></td>
  107. </tr>
  108. <tr valign="middle">
  109. <td colspan="1" rowspan="1" align="left">4</td>
  110. <td colspan="1" rowspan="1" align="left"><a href="function.eregi-replace.html" class="function">eregi_replace()</a></td>
  111. <td colspan="1" rowspan="1" align="left"><a href="function.mb-eregi-replace.html" class="function">mb_eregi_replace()</a></td>
  112. </tr>
  113. <tr valign="middle">
  114. <td colspan="1" rowspan="1" align="left">4</td>
  115. <td colspan="1" rowspan="1" align="left"><a href="function.split.html" class="function">split()</a></td>
  116. <td colspan="1" rowspan="1" align="left"><a href="function.mb-split.html" class="function">mb_split()</a></td>
  117. </tr>
  118. </tbody>
  119. </colgroup>
  120. </table>
  121. </p>
  122. <blockquote><p><b class="note">Note</b>:
  123. It is not recommended to use the function overloading option in
  124. the per-directory context, because it&#039;s not confirmed yet to be
  125. stable enough in a production environment and may lead to undefined
  126. behaviour.
  127. <br />
  128. </p></blockquote>
  129. </div>
  130. <hr /><div style="text-align: center;">
  131. <div class="prev" style="text-align: left; float: left;"><a href="mbstring.supported-encodings.html">Supported Character Encodings</a></div>
  132. <div class="next" style="text-align: right; float: right;"><a href="mbstring.php4.req.html">PHP Character Encoding Requirements</a></div>
  133. <div class="up"><a href="book.mbstring.html">Multibyte String</a></div>
  134. <div class="home"><a href="index.html">PHP Manual</a></div>
  135. </div></body></html>