Page 1 of 1

need help abt PHP on very basic steps

Posted: Sun Aug 23, 2009 12:26 pm
by fiza
Hi All
this is fiza
new 2 this forum
nd just started my developmnt career
bt stil having lots of quries
hop u guize vil help me
im learing php wid tuorials aswell
bt didnt get the logics
like in nested loop i hv example
i want print like this..nd i used following statmnt
* * * * *
* * * *
* * *
**
*
<?php
for($x=0; $x<=10; $x++);
for($y=0; $y<=10; $y++);
echo "*"
?>

so kindly help me abt this statment..
nd also tel me how i can clear my logics regarding PHP

tnx

Re: need help abt PHP on very basic steps

Posted: Sun Aug 23, 2009 12:45 pm
by Mark Baker

Code: Select all

 
for($x=5; $x>0; $x--) {
   for($y=1; $y<=$x; $y++) {
      echo '*';
   }
   echo '<br />';
}
 
or

Code: Select all

 
for($x=5; $x>0; $x--) {
   echo str_repeat('*',$x).'<br />';
}