$col = 4;
$index = 0;
$share_display = array();
foreach($share_list as $share)
{
$mod = $index % $col;
$share_display['col'.$mod][] = $share;
$index++;
}不是很明白 ,,好像这个代码的意思是,将数组分SHARE_LIST打散成四个子数组赋给SHARE_DISPLAY

解决方案 »

  1.   

    $index% $col 得到$index除以$col的余数
      

  2.   

    我查了下,说是取模运算符,不过,我得到的数值结果是$share_display['col'.$mod][]下只有COL只有4个项这么说$mod的值一直是在0123循环了,,可$share_list下一共有40个值,,,40除4都到10了
      

  3.   

    对呀,数组 $share_list 被分散到 4 个子数组中去了