<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.chunk-split.php',
    1 => 'chunk_split',
    2 => 'Divide una stringa in segmento pi&ugrave; piccoli',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.chr.php',
    1 => 'chr',
  ),
  'next' => 
  array (
    0 => 'function.convert-cyr-string.php',
    1 => 'convert_cyr_string',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/strings/functions/chunk-split.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.chunk-split" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">chunk_split</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">chunk_split</span> &mdash; <span class="dc-title">Divide una stringa in segmento più piccoli</span></p>

   </div>
   <div class="refsect1 unknown-1258" id="refsect1-function.chunk-split-unknown-1258">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>chunk_split</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$body</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$chunklen</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$end</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

    <p class="para rdfs-comment">
     Questa funzione può essere utilizzata per suddividere una stringa in segmenti più ridotti, per
     possono essere utili, ad esempio, nel convertire l&#039;output della funzione <span class="function"><a href="function.base64-encode.php" class="function">base64_encode()</a></span> in modo
     da aderire alle specifiche indicate nella RFC 2045. La funzione inserisce <code class="parameter">end</code> (il default
     è &quot;\r\n&quot;) ad ogni <code class="parameter">chunklen</code> caratteri (default è 
     76). La funzione restituisce una nuova stringa lasciando inalterata la stringa originale.
     <div class="example" id="example-1">
      <p><strong>Example #1 Esempio di uso di <span class="function"><strong>chunk_split()</strong></span></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: #FF8000">// format $data using RFC 2045 semantics<br /></span><span style="color: #0000BB">$new_string </span><span style="color: #007700">= </span><span style="color: #0000BB">chunk_split</span><span style="color: #007700">(</span><span style="color: #0000BB">base64_encode</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
    <p class="simpara">
     Vedere anche <span class="function"><a href="function.str-split.php" class="function">str_split()</a></span>,
     <span class="function"><a href="function.explode.php" class="function">explode()</a></span>, <span class="function"><strong>split()</strong></span>, 
     <span class="function"><a href="function.wordwrap.php" class="function">wordwrap()</a></span> e
     <a href="https://datatracker.ietf.org/doc/html/rfc2045" class="link external">&raquo;&nbsp;RFC 2045</a>.
    </p>
   </div>

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