Skip to content

Instantly share code, notes, and snippets.

@3Shoka
Created May 29, 2016 04:37
Show Gist options
  • Save 3Shoka/93944f86eab6876b57d01dc4378c3606 to your computer and use it in GitHub Desktop.
Save 3Shoka/93944f86eab6876b57d01dc4378c3606 to your computer and use it in GitHub Desktop.
<?php
$a =".";
$spc = " ";
$ulang = 20;
for ($i=0; $i < $ulang; $i++) {
// bikin kondisi angka ganjil
if ($i%2==1) {
// cetak spasi setengah dari total $ulang
for ($j=($ulang-$i)/2; $j >=0; $j--) {
echo $spc;
}
// baru cetak titiknya
for ($k=0; $k < $i; $k++) {
echo $a;
usleep(60000);
}
echo PHP_EOL;
}
}
// kalo total titiknya udah mentok maksimal dari ulang
// baru bikin kebalikan loopnya
for ($l=0; $l <= $ulang; $l++) {
if ($l%2==1) {
for ($m=0; $m < $l/2; $m++) {
echo $spc;
}
for ($n=($ulang-$l); $n > 0; $n--) {
echo $a;
usleep(60000);
}
echo PHP_EOL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment