Last active
October 8, 2021 07:59
-
-
Save ahmadrosid/f68646531f390e978653b9f79e242fbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function colorized($var) | |
{ | |
return "\e[0;30;42m$var\e[0m"; | |
} | |
$firstRowIndex = 3; | |
$secondRowIndex = 2; | |
for ($i = 1; $i <= 64; $i++) { | |
for ($j = 1; $j <= 3; $j++) { | |
if ($j == $firstRowIndex ) { | |
echo " $i "; | |
} else { | |
echo colorized(" $i "); | |
} | |
$i++; | |
} | |
$i++; | |
echo " $i "; | |
$firstRowIndex++; | |
$firstRowIndex = $firstRowIndex == 4 ? 1 : $firstRowIndex; | |
for ($k = 1; $k <= 3; $k++) { | |
if ($k == $secondRowIndex ) { | |
echo " $i "; | |
} else { | |
echo colorized(" $i "); | |
} | |
$i++; | |
} | |
echo " $i\n"; | |
$secondRowIndex++; | |
$secondRowIndex = $secondRowIndex == 4 ? 1 : $secondRowIndex; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment