<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mbstring.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.mb-scrub.php',
    1 => 'mb_scrub',
    2 => 'Replace ill-formed byte sequences with the substitute character',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'Multibyte String Functions',
  ),
  'prev' => 
  array (
    0 => 'function.mb-rtrim.php',
    1 => 'mb_rtrim',
  ),
  'next' => 
  array (
    0 => 'function.mb-send-mail.php',
    1 => 'mb_send_mail',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mbstring/functions/mb-scrub.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-scrub" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_scrub</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0, PHP 8)</p><p class="refpurpose"><span class="refname">mb_scrub</span> &mdash; <span class="dc-title">Replace ill-formed byte sequences with the substitute character</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mb-scrub-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_scrub</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Perform a character set conversion from the specified encoding, or the default encoding if no
   encoding was specified, to the same encoding. This has the effect of replacing any invalid
   byte sequences with the substitute character.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-scrub-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">string</code></dt>
    <dd>
     <p class="para">
      The input string.
     </p>
    </dd>
   
   
    <dt><code class="parameter">encoding</code></dt>
    <dd>
     <p class="para">
      The encoding used to interpret <code class="parameter">string</code>.
      If it is omitted or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, the
      <a href="mbstring.configuration.php#ini.mbstring.internal-encoding" class="link">mbstring.internal_encoding setting</a>
      will be used if set, otherwise the <a href="ini.core.php#ini.default-charset" class="link">default_charset setting</a>
      will be used.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mb-scrub-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The <span class="type"><a href="language.types.string.php" class="type string">string</a></span> result with invalid byte sequences replaced.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-scrub-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.0.0</td>
 <td>
  <code class="parameter">encoding</code> is nullable now.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


</div><?php manual_footer($setup); ?>