<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Array] array_chunk()]]></title><description><![CDATA[<p dir="auto"><em>Sintassi:</em> array_chunk ( array <em>$array_input</em>, int <em>$dimensione</em> [,bool <em>$chiavi</em>] )</p>
<p dir="auto"><em><strong>array_chunk</strong></em> spezza l'array <em>$array_input</em> in più array di dimesione <em>$dimesione</em>:</p>
<pre><code class="language-php">$array_input = array(1,2,3,'a','b',4,'c');
$dimensione = 2;
$test=array_chunk($array_input, $dimensione);
 
print_r($test); // stamperà:
 
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; 1
            [1] =&gt; 2
        )
    [1] =&gt; Array
        (
            [0] =&gt; 3
            [1] =&gt; a
        )
    [2] =&gt; Array
        (
            [0] =&gt; b
            [1] =&gt; 4
        )
    [3] =&gt; Array
        (
            [0] =&gt; c
        )
)
</code></pre>
<p dir="auto">Ovviamente l'ultimo array potrebbe contenere meno valori di quanto indicato in <em>$dimensione</em>.<br />
Se viene impostato il paramentro opzionale <em>$chiavi</em> su <em>TRUE</em> (di default è impostato su <em>FALSE</em>) si forzano i nuovi array a mantenere le chiavi di <em>$array_input</em>:</p>
<pre><code class="language-php">$array_input = array(1,2,3,'a','b',4,'c');
$dimensione = 2;
$test=array_chunk($array_input, $dimensione, TRUE);
 
print_r($test); // stamperà:
 
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; 1
            [1] =&gt; 2
        )
 
    [1] =&gt; Array
        (
            [2] =&gt; 3
            [3] =&gt; a
        )
 
    [2] =&gt; Array
        (
            [4] =&gt; b
            [5] =&gt; 4
        )
 
    [3] =&gt; Array
        (
            [6] =&gt; c
        )
)
</code></pre>
]]></description><link>https://dev.connect.gt/topic/60432/array-array_chunk</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 13:20:54 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/60432.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Jan 2008 19:37:14 GMT</pubDate><ttl>60</ttl></channel></rss>