'Pattern HoneyComb duplicating pattern

I am doing a pattern in php (Honey Comb pattern). My code is correct but how can I duplicate the pattern to take an argument of row and column.

Example: Row: 2 Column: 1 The pattern will duplicate next to each other.

Row: 2 Column: 2 The pattern will duplicate next to each other and on top of each other.

Thank you

<?php
function HoneyComb(){
for($i=2; $i<=4; $i++)
{
 for($j=4; $j>=2; $j--)
 {
  if($i == $j)
   echo "*";
  else
   echo "&nbsp;&nbsp;";
 }
 for($k=2; $k<=4; $k++)
 {
  if($i == $k)
   echo "*";
  else
   echo "&nbsp;&nbsp;";
 }
 echo "<br>";
}

for($i=4; $i>=2; $i--)
{
 for($j=4; $j>=2; $j--)
 {
  if($i == $j)
   echo "*";
  else
   echo "&nbsp;&nbsp;";
 }
 for($k=2; $k<=4; $k++)
 {
  if($i == $k)
   echo "*";
  else
   echo "&nbsp;&nbsp;";
 }
 echo "<br>";
}
}

HoneyComb();


?>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source