I saw it occasionally. Then print it out in PHP.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvegluz2ppz29uz3np/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
There are two ways to resolve this issue:
Method One: According to the graph analysis of the graph is a two-dimensional array, two-dimensional array can solve such problems, 6 rows is 6 arrays, each row represents the array of how many elements. Know the number of elements in each array. Can you tell which elements are in the array?
function array_chunk_vertical ($arr, $colun) { $arr _length = count ($arr); $parem = Floor ($arr _length/$colun); $pare = $arr _length% $colun; $ar = Array (); for ($i = 0; $i < $colun; $i + +) { $par = $i = = $colun-1? 1:5; $ar [] = $par; } $newarray = Array (); foreach ($ar as $value) {for ($i = 0; $i < $value; $i + +) { $newarray [$i] = Array_shift ($arr); } } return $newarray;} $arr = Range (1, +), $data = Array_chunk_vertical ($arr, 7), foreach ($data as $value) { foreach ($value as $va) { printf (' [%2s] ', $va); } echo "<br/>";}
Method Two: such as code. An empty array of size is given first. Fills the element in an empty array.
Detailed methods such as the following:
<?
PHP function array_chunk_vertical ($input, $size, $preserve _keys = False, $size _is_horizontal = False) {$chunk s = Array (); if ($size _is_horizontal) {$chunk _count = ceil (count ($input)/$size); } else {$chunk _count = $size; } for ($chunk _index = 0; $chunk _index < $chunk _count; $chunk _index++) {$chunks [] = array (); } $chunk _index = 0; foreach ($input as $key = + $value) {if ($preserve _keys) {$chunks [$chunk _index][$key] = $value; } else {$chunks [$chunk _index][] = $value; if (+ + $chunk _index = = $chunk _count) {$chunk _index = 0; }} return $chunks;} $data =range (1,31), $newdata =array_chunk_vertical ($data, 6), foreach ($newdata as $root) {foreach ($root as $val) {p rintf (' [%2s] ', $val); } echo "<br/>";}
How does the PHP algorithm------------print out