<?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 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.mb-strimwidth.php',
    1 => 'mb_strimwidth',
    2 => 'Get truncated string with specified width',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'Multibyte String Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.mb-strcut.php',
    1 => 'mb_strcut',
  ),
  'next' => 
  array (
    0 => 'function.mb-stripos.php',
    1 => 'mb_stripos',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mbstring/functions/mb-strimwidth.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-strimwidth" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_strimwidth</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_strimwidth</span> &mdash; <span class="dc-title">Get truncated string with specified width</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-strimwidth-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_strimwidth</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$start</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$width</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$trim_marker</code><span class="initializer"> = &quot;&quot;</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<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><br>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Truncates <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">string</code> to specified <code class="parameter">width</code>,
   where halfwidth characters count as <code class="literal">1</code>, and fullwidth
   characters count as <code class="literal">2</code>.
   See <a href="http://www.unicode.org/reports/tr11/" class="link external">&raquo;&nbsp;http://www.unicode.org/reports/tr11/</a>
   for details regarding East Asian character widths.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-strimwidth-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       The <span class="type"><a href="language.types.string.php" class="type string">string</a></span> being decoded.
      </p>
     </dd>
    
    
     <dt><code class="parameter">start</code></dt>
     <dd>
      <p class="para">
       The start position offset. Number of
       characters from the beginning of string (first character is 0),
       or if start is negative, number of characters from the end of the string.
      </p>
     </dd>
    
    
     <dt><code class="parameter">width</code></dt>
     <dd>
      <p class="para">
       The width of the desired trim.
       If negative width is specified, count from the end of the string.
       <blockquote class="note"><p><strong class="note">Nota</strong>: 
        <p class="para">
         Passing negative width is deprecated as of PHP 8.3.0.
        </p>
       </p></blockquote>
      </p>
     </dd>
    
    
     <dt><code class="parameter">trim_marker</code></dt>
     <dd>
      <p class="para">
       A string that is added to the end of string 
       when string is truncated.
      </p>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para">Il parametro <code class="parameter">encoding</code> 
è la codifica dei caratteri. Se è omesso, verrà utilizzata la 
codifica interna.</p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mb-strimwidth-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   The truncated <span class="type"><a href="language.types.string.php" class="type string">string</a></span>. If <code class="parameter">trim_marker</code> is set,
   <code class="parameter">trim_marker</code> replaces the last chars to match the <code class="parameter">width</code>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-strimwidth-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versione</th>
      <th>Descrizione</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.3.0</td>
      <td>
       Passing a negative <code class="parameter">width</code> to
       <span class="function"><strong>mb_strimwidth()</strong></span> is now deprecated.
      </td>
     </tr>

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

     <tr>
      <td>7.1.0</td>
      <td>
       Support for negative <code class="parameter">start</code>s and <code class="parameter">width</code>s has been added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.mb-strimwidth-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>mb_strimwidth()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">mb_strimwidth</span><span style="color: #007700">(</span><span style="color: #DD0000">"Hello World"</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">, </span><span style="color: #DD0000">"..."</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// output: "Hello W..."<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 seealso" id="refsect1-function.mb-strimwidth-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mb-strwidth.php" class="function" rel="rdfs-seeAlso">mb_strwidth()</a> - Return width of string</span></li>
    <li><span class="function"><a href="function.mb-internal-encoding.php" class="function" rel="rdfs-seeAlso">mb_internal_encoding()</a> - Set/Get internal character encoding</span></li>
   </ul>
  </p>
 </div>


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