Skip to content

Instantly share code, notes, and snippets.

@MrShennawy
Created January 12, 2018 07:48
Show Gist options
  • Save MrShennawy/8734d39deefcfd2c38a045ca62ebc6b9 to your computer and use it in GitHub Desktop.
Save MrShennawy/8734d39deefcfd2c38a045ca62ebc6b9 to your computer and use it in GitHub Desktop.
how to get custom number of items in the same row at every loop
<?php
$arr = ['a','b','c','d','f','g'];
$a = 0;
foreach ($arr as $value) {
// 3 it's number of items
if($a % 3 == 0){
echo "<br>";
}
echo $value;
$a++;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment