Below, there are some patterns related to star, number and alphabets that are also asked in interview to test your logic. Some below:
";
}
?>
=1;$i--)
{
for($j=0;$j<$i;$j++)
{
echo "*";
}
echo "
";
}
?>
";
}
?>
";
}
?>
=$i; $j--)
{
echo " ";
}
for($k=1; $k<=$i; $k++)
{
echo $k." ";
}
for($m=($i-1); $m>=1; $m--)
{
echo $m." ";
}
echo "
";
}
?>
=($i + 1); $j--)
{
echo " ";
}
for($k=1; $k<=$i; $k++)
{
echo "*"." ";
}
for($m=2; $m<=$i; $m++)
{
echo "*"." ";
}
echo "
";
}
?>