大家帮我看下这段代码中的“%”是什么意思
$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
[解决办法]
$index% $col 得到$index除以$col的余数
[解决办法]
取余 `
[解决办法]
求余数,你没学过算数吗?
[解决办法]
对呀,数组 $share_list 被分散到 4 个子数组中去了
[解决办法]