Adalente adlı üyeden alıntı: mesajı görüntüle
Merhaba,

Bir foreach döngüm var bu döngü içinde 20 adet liste var bu listeleri 10 ar adet şeklinde nasıl listelerim.

Örnek : İlk 10 a divi içinde olacak sonraki 10 b divinin.

<?php 
$arr = [
    "1",
    "2",
    "3",
    "4",
    "5",
    "6",
    "7",
    "8",
    "9",
    "10",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "19",
    "20"
];
$number = 0;
$first10 = [];
$second10 = [];
foreach ($arr as $key => $value) :
    $number++;
    if ($number <= 10) :
        array_push($first10, $value);
    elseif ($number > 10) :
        array_push($second10, $value);
    endif;
endforeach; 
?>
<div class="col-lg-6">
    <ul class="bullets">
        <?php foreach ($first10 as $value) : ?>
            <li> <?= $value ?></li>
        <?php endforeach; ?>
    </ul>
</div>
<div class="col-lg-6">
    <ul class="bullets">
        <?php foreach ($second10 as $value) : ?>
            <li> <?= $value ?></li>
        <?php endforeach; ?>
    </ul>
</div>