Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- <?php
- //rata kiri
- $bil=isset($_GET['b'])?$_GET['b']:6;
- for($i=0;$i<=$bil;$i++){
- for($j=0;$j<$i;$j++){
- echo "* ";
- }
- echo "\n";
- }
- //rata tengah
- for($i=0;$i<=$bil;$i++){
- $o="";
- for($j=0;$j<$i;$j++){
- $o.="* ";
- }
- echo str_pad($o,2*$bil," ",STR_PAD_BOTH)."\n";
- }
- //rata kanan
- for($i=0;$i<=$bil;$i++){
- $o="";
- for($j=0;$j<$i;$j++){
- $o.="* ";
- }
- echo str_pad($o,2*$bil," ",STR_PAD_LEFT)."\n";
- }
- ?>
- </pre>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement