A
A
apple-apple2018-03-06 17:59:37
PHP
apple-apple, 2018-03-06 17:59:37

How to solve a problem in php?

There is an object of 12 elements, you need to display it in groups in the layout. 3 elements per group. How to do it right?

<div class="group">
<div class="item">Элемент 1</div>
<div class="item">Элемент 2</div>
<div class="item">Элемент 3</div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-03-06
@Stalker_RED

array_chunk() to break into pieces.
foreach over these parts, wrapping each in a group, and displaying the elements.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question