Skip to content

Instantly share code, notes, and snippets.

@ahkmunna
Created November 28, 2018 14:51
Show Gist options
  • Save ahkmunna/0b6022de617115cb3394643588f19000 to your computer and use it in GitHub Desktop.
Save ahkmunna/0b6022de617115cb3394643588f19000 to your computer and use it in GitHub Desktop.
$arr = range(10,100);
$i=1; $j=4;
foreach($arr as $value)
{
echo '*'; // Print the column
if($i != 0 && $i%$j == 0)
{
echo '<br/>'; // Set new row
$i = 0; $j = ($j == 4) ? 3 : 4; // Reset the logic
}
$i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment