Last active
September 20, 2016 09:26
-
-
Save yudaprawira/771349707488d5133744cae82c9153b5 to your computer and use it in GitHub Desktop.
PHP Piramida Asterisk
This file contains 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 | |
$GLOBALS['n'] = 15; YP('*', $GLOBALS['n'], 'down') . YP('*', 2, 'up'); | |
function YP($t, $c, $tipe='down') { | |
echo str_repeat(' ', $GLOBALS['n'] - $c) . str_repeat($t, $c) . "<br/>"; | |
$tipe=='down' ? $c-- : $c++; if ($c>0 && $c<=$GLOBALS['n']) YP($t, $c, $tipe); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment