Jitendra
Posted on August 21, 2018
Some patterns created with (nested) loops. Please comment if you have any.
Code:
for ($i = 0; $i < 10; $i++) {
for ($j = 0; $j < 10; $j++) {
if (in_array($j, [0, 9, $i]) || in_array($i, [0, 9, 9 - $j])) {
echo "#";
} else {
echo ' ';
}
}
echo "\n";
}
Output:
##########
## ##
# # # #
# # # #
# ## #
# ## #
# # # #
# # # #
## ##
##########
💖 💪 🙅 🚩
Jitendra
Posted on August 21, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.