Last active
September 19, 2017 21:08
-
-
Save Shipu/e91956db869365dcc24905e7673091d6 to your computer and use it in GitHub Desktop.
Dynamic Splits Array like as "array_chunk()"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = [10,2,32,41,21,18,17,6,59]; | |
$arraySize = count($data); | |
$chunkSize = 2; | |
echo "<div class='own-countersoul'>"; | |
for($i = 0; $i < $arraySize; ) { | |
echo "<div class='item'>"; | |
for($j = 0; $j < $chunkSize && $i < $arraySize ; $j++, $i++) { | |
echo "<div class='single_item'>".$data[$i]."</div>"; | |
} | |
echo "</div>"; | |
} | |
echo "</div>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment