[SOLVED] How to output something like this
Posted: Sat Aug 05, 2006 7:48 am
Hello all.. Been following alot of PHPDN forum posts but just got the time to join.
So I got asked to output result like this in object oriented way.
In a slight look, I thought that must be not to hard. Just construct a loop function or so and it would be done in a sec.. Unfortunately I feel my brain not working today. Been spending an hour with no result.. Im stuck..
so any hint on what should I do/modify would be greatly appreciated. I thought I have passed the basic of PHP and can move on to more advance level.. I am so embarased to myself I cant even output that.
My last minute code
with last minute result..
So I got asked to output result like this in object oriented way.
Code: Select all
*
**
***
****My last minute code
Code: Select all
class stars {
var $star;
var $max;
function throwStars(){
for($i=0; $i<=$this->max; $i++){
for($a=$i; $a<$this->max; $a++){
echo $this->star;
}
echo '<br />';
}
}
}
$test = new stars;
$test->star='a';
$test->max=3;
$test->throwStars();Code: Select all
aaa
aa
a