array_chunk
array_chunk(array $input, int $size, [, bool $preserve_keys=false])
<code><span>$input</span>=<span>array</span>(<span>"a"</span>=><span>"php"</span>,<span>"b"</span>=><span>"c"</span>,<span>"c"</span>=><span>"c++"</span>,<span>"d"</span>=><span>"python"</span>,<span>"e"</span>=><span>"ruby"</span>); <span>$output</span> = array_chunk(<span>$input</span>, <span>2</span>); <span>#output=></span><span>Array</span> ( [<span>0</span>] => <span>Array</span> ( [<span>0</span>] => php [<span>1</span>] => c ) [<span>1</span>] => <span>Array</span> ( [<span>0</span>] => c++ [<span>1</span>] => python ) [<span>2</span>] => <span>Array</span> ( [<span>0</span>] => ruby ) ) <span>$output2</span> = array_chunk(<span>$input</span>, <span>2</span>, <span>true</span>); <span>#output2=> </span><span>Array</span> ( [<span>0</span>] => <span>Array</span> ( [a] => php [b] => c ) [<span>1</span>] => <span>Array</span> ( [c] => c++ [d] => python ) [<span>2</span>] => <span>Array</span> ( [e] => ruby ) ) <span>#注意子数组中的key还是保留原来数组中的key</span></code>
위의 내용을 포함하여 [php 함수]--배열 함수--array_chunk를 소개합니다. PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되길 바랍니다.