Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 4179

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Encode string for MIME header</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-detect-order.html">mb_detect_order</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-encode-numericentity.html">mb_encode_numericentity</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-encode-mimeheader" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_encode_mimeheader</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5)</p><p class="refpurpose"><span class="refname">mb_encode_mimeheader</span> &mdash; <span class="dc-title">Encode string for MIME header</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-encode-mimeheader-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>mb_encode_mimeheader</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$str</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$charset</code><span class="initializer"> = mb_internal_encoding()</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$transfer_encoding</code><span class="initializer"> = &quot;B&quot;</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$linefeed</code><span class="initializer"> = &quot;\r\n&quot;</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$indent</code><span class="initializer"> = 0</span></span>
  ]]]] )</div>

  <p class="para rdfs-comment">
   Encodes a given <span class="type"><a href="language.types.string.html" class="type string">string</a></span>
   <em><code class="parameter">str</code></em> by the MIME header encoding scheme.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-encode-mimeheader-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">str</code></em></span>
     <dd>

      <p class="para">
       The <span class="type"><a href="language.types.string.html" class="type string">string</a></span> being encoded.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">charset</code></em></span>
     <dd>

      <p class="para">
       <em><code class="parameter">charset</code></em> specifies the name of the character set
       in which <em><code class="parameter">str</code></em> is represented in. The default value
       is determined by the current NLS setting (<em>mbstring.language</em>).
        <span class="function"><a href="function.mb-internal-encoding.html" class="function">mb_internal_encoding()</a></span> should be set to same encoding.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">transfer_encoding</code></em></span>
     <dd>

      <p class="para">
       <em><code class="parameter">transfer_encoding</code></em> specifies the scheme of MIME
       encoding. It should be either <em>&quot;B&quot;</em> (Base64) or
       <em>&quot;Q&quot;</em> (Quoted-Printable). Falls back to
       <em>&quot;B&quot;</em> if not given.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">linefeed</code></em></span>
     <dd>

      <p class="para">
       <em><code class="parameter">linefeed</code></em> specifies the EOL (end-of-line) marker
       with which  <span class="function"><strong>mb_encode_mimeheader()</strong></span> performs
       line-folding (a <a href="http://www.faqs.org/rfcs/rfc2822" class="link external">&raquo;&nbsp;RFC</a> term,
       the act of breaking a line longer than a certain length into multiple
       lines. The length is currently hard-coded to 74 characters).
       Falls back to <em>&quot;\r\n&quot;</em> (CRLF) if not given.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">indent</code></em></span>
     <dd>

      <p class="para">
       Indentation of the first line (number of characters in the header
       before <em><code class="parameter">str</code></em>).
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.mb-encode-mimeheader-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   A converted version of the <span class="type"><a href="language.types.string.html" class="type string">string</a></span> represented in ASCII.
  </p>
 </div>


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

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.0.0</td>
       <td>
        The <em><code class="parameter">indent</code></em> parameter was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mb-encode-mimeheader-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-2708">
    <p><strong>Example #1  <span class="function"><strong>mb_encode_mimeheader()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$name&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;kanji<br /></span><span style="color: #0000BB">$mbox&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"kru"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$doma&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"gtinn.mon"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$addr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mb_encode_mimeheader</span><span style="color: #007700">(</span><span style="color: #0000BB">$name</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"UTF-7"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Q"</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&nbsp;&lt;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$mbox&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"@"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$doma&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">$addr</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.mb-encode-mimeheader-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function isn&#039;t designed to break lines at higher-level
    contextual break points (word boundaries, etc.).
    This behaviour may clutter up the original string with unexpected spaces.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mb-encode-mimeheader-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.mb-decode-mimeheader.html" class="function" rel="rdfs-seeAlso">mb_decode_mimeheader()</a> - Decode string in MIME header field</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-detect-order.html">mb_detect_order</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-encode-numericentity.html">mb_encode_numericentity</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>