<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Set/Get substitution character</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mb-strwidth.html">mb_strwidth</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mb-substr-count.html">mb_substr_count</a></div> <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.mb-substitute-character" class="refentry"> <div class="refnamediv"> <h1 class="refname">mb_substitute_character</h1> <p class="verinfo">(PHP 4 >= 4.0.6, PHP 5)</p><p class="refpurpose"><span class="refname">mb_substitute_character</span> — <span class="dc-title">Set/Get substitution character</span></p> </div> <div class="refsect1 description" id="refsect1-function.mb-substitute-character-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>mb_substitute_character</strong></span> ([ <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$substrchar</code><span class="initializer"> = mb_substitute_character()</span></span> ] )</div> <p class="para rdfs-comment"> Specifies a substitution character when input character encoding is invalid or character code does not exist in output character encoding. Invalid characters may be substituted <strong><code>NULL</code></strong> (no output), <span class="type"><a href="language.types.string.html" class="type string">string</a></span> or <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> value (Unicode character code value). </p> <p class="para"> This setting affects <span class="function"><a href="function.mb-convert-encoding.html" class="function">mb_convert_encoding()</a></span>, <span class="function"><a href="function.mb-convert-variables.html" class="function">mb_convert_variables()</a></span>, <span class="function"><a href="function.mb-output-handler.html" class="function">mb_output_handler()</a></span>, and <span class="function"><a href="function.mb-send-mail.html" class="function">mb_send_mail()</a></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.mb-substitute-character-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">substrchar</code></em></span> <dd> <p class="para"> Specify the Unicode value as an <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>, or as one of the following <span class="type"><a href="language.types.string.html" class="type string">string</a></span>s: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <em>"none"</em>: no output </span> </li> <li class="listitem"> <span class="simpara"> <em>"long"</em>: Output character code value (Example: U+3000, JIS+7E7E) </span> </li> <li class="listitem"> <span class="simpara"> <em>"entity"</em>: Output character entity (Example: Ȁ) </span> </li> </ul> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.mb-substitute-character-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> If <em><code class="parameter">substchar</code></em> is set, it returns <strong><code>TRUE</code></strong> for success, otherwise returns <strong><code>FALSE</code></strong>. If <em><code class="parameter">substchar</code></em> is not set, it returns the current setting. </p> </div> <div class="refsect1 examples" id="refsect1-function.mb-substitute-character-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2723"> <p><strong>Example #1 <span class="function"><strong>mb_substitute_character()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">/* Set with Unicode U+3013 (GETA MARK) */<br /></span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">(</span><span style="color: #0000BB">0x3013</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Set hex format */<br /></span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">(</span><span style="color: #DD0000">"long"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Display current setting */<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mb-strwidth.html">mb_strwidth</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mb-substr-count.html">mb_substr_count</a></div> <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>