$kp_id_ar = array();
if ($kp_id_vidcdn != 0) array_push($kp_id_ar, $kp_id_vidcdn);
if ($kp_id_bazon != 0) array_push($kp_id_ar, $kp_id_bazon);
if ($kp_id_ustore != 0) array_push($kp_id_ar, $kp_id_ustore);
$result = array_count_values($kp_id_ar);
if(count($kp_id_ar) == 1){
foreach($result as $id=>$cnt) $kp_id = $id;
$cnt = 0;
}else{
foreach($result as $id=>$cnt) {
if($cnt>1) $kp_id = $id;
$cnt = 0;
}
}
print $kp_id;
$array= Array([0] => Array ( [name] => 1699 ) ,[1] => Array ( [name] => 1669 )) // масив намного длиней но структура однотипная
$num = 0;
$col = 5000;
$val = $col;
$sum = count($array);
$cel = (intdiv($sum, $col) * $col);
$ost = $sum - $cel;
foreach($array as $i => $value):
if ($i < $val){
print base_url("watch/".$value['name'].".html")."<br>";
}else{
print '<br>';
print '<br>';
if ($i >= $cel){
$val = $val + $ost - 1;
}else{
$val = $val + $col;
}
}
endforeach;