<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.mbstring.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'mbstring.overload.php',
    1 => 'Function Overloading Feature',
    2 => 'Function Overloading Feature',
  ),
  'up' => 
  array (
    0 => 'book.mbstring.php',
    1 => 'Multibyte String',
  ),
  'prev' => 
  array (
    0 => 'mbstring.supported-encodings.php',
    1 => 'Supported Character Encodings',
  ),
  'next' => 
  array (
    0 => 'mbstring.php4.req.php',
    1 => 'PHP Character Encoding Requirements',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mbstring/overloading.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mbstring.overload" class="chapter">
 <h1 class="title">
  Function Overloading Feature
 </h1>


 <div class="warning"><strong class="warning">Avviso</strong><p class="simpara">This feature has been
<em>DEPRECATED</em> as of PHP 7.2.0, and <em>REMOVED</em> as of PHP 8.0.0. Relying on this feature
is highly discouraged.</p></div>

 <p class="para">
  You might often find it difficult to get an existing PHP application
  to work in a given multibyte environment. This happens because most 
  PHP applications out there are written with the standard string 
  functions such as <span class="function"><a href="function.substr.php" class="function">substr()</a></span>, which are known to 
  not properly handle multibyte-encoded strings.
 </p>
 <p class="para">
  mbstring supports a &#039;function overloading&#039; feature which enables
  you to add multibyte awareness to such an application without
  code modification by overloading multibyte counterparts on
  the standard string functions. For example,
  <span class="function"><a href="function.mb-substr.php" class="function">mb_substr()</a></span> is called instead of
  <span class="function"><a href="function.substr.php" class="function">substr()</a></span> if function overloading is enabled.
  This feature makes it easy to port applications that only support
  single-byte encodings to a multibyte environment in many cases.
 </p>
 <p class="para">
  To use function overloading, set
  <code class="literal">mbstring.func_overload</code> in <var class="filename">php.ini</var> to a
  positive value that represents a combination of bitmasks specifying
  the categories of functions to be overloaded. It should be set
  to 1 to overload the <span class="function"><a href="function.mail.php" class="function">mail()</a></span> function. 2 for string
  functions, 4 for regular expression functions. For example,
  if it is set to 7, mail, strings and regular expression functions will
  be overloaded. The list of overloaded functions are shown below.
  <table class="doctable table">
   <caption><strong>Functions to be overloaded</strong></caption>
   
    <thead>
     <tr>
      <th>value of mbstring.func_overload</th>
      <th>original function</th>
      <th>overloaded function</th>
     </tr>

   </thead>

   <tbody class="tbody">
     <tr>
      <td>1</td>
      <td><span class="function"><a href="function.mail.php" class="function">mail()</a></span></td>
      <td><span class="function"><a href="function.mb-send-mail.php" class="function">mb_send_mail()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strlen.php" class="function">strlen()</a></span></td>
      <td><span class="function"><a href="function.mb-strlen.php" class="function">mb_strlen()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strpos.php" class="function">strpos()</a></span></td>
      <td><span class="function"><a href="function.mb-strpos.php" class="function">mb_strpos()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strrpos.php" class="function">strrpos()</a></span></td>
      <td><span class="function"><a href="function.mb-strrpos.php" class="function">mb_strrpos()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.substr.php" class="function">substr()</a></span></td>
      <td><span class="function"><a href="function.mb-substr.php" class="function">mb_substr()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strtolower.php" class="function">strtolower()</a></span></td>
      <td><span class="function"><a href="function.mb-strtolower.php" class="function">mb_strtolower()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strtoupper.php" class="function">strtoupper()</a></span></td>
      <td><span class="function"><a href="function.mb-strtoupper.php" class="function">mb_strtoupper()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.stripos.php" class="function">stripos()</a></span></td>
      <td><span class="function"><a href="function.mb-stripos.php" class="function">mb_stripos()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strripos.php" class="function">strripos()</a></span></td>
      <td><span class="function"><a href="function.mb-strripos.php" class="function">mb_strripos()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strstr.php" class="function">strstr()</a></span></td>
      <td><span class="function"><a href="function.mb-strstr.php" class="function">mb_strstr()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.stristr.php" class="function">stristr()</a></span></td>
      <td><span class="function"><a href="function.mb-stristr.php" class="function">mb_stristr()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.strrchr.php" class="function">strrchr()</a></span></td>
      <td><span class="function"><a href="function.mb-strrchr.php" class="function">mb_strrchr()</a></span></td>
     </tr>

     <tr>
      <td>2</td>
      <td><span class="function"><a href="function.substr-count.php" class="function">substr_count()</a></span></td>
      <td><span class="function"><a href="function.mb-substr-count.php" class="function">mb_substr_count()</a></span></td>
     </tr>

    </tbody>
   
  </table>

 </p>
 <blockquote class="note"><p><strong class="note">Nota</strong>: 
  <p class="para">
   It is not recommended to use the function overloading option in
   the per-directory context, because it&#039;s not confirmed yet to be
   stable enough in a production environment and may lead to undefined
   behaviour.
  </p>
 </p></blockquote>
</div>
<?php manual_footer($setup); ?>