Namuk
Mar 15th 2008, 9:43 am
i got a problem about calculation...
this is my problem...
$score = 0;
//this is come form random choose by computer.
if(condition)
{
$result = 1;
}
elseif(condition)
{
$result = -1;
}
else
{
$result = 0;
}
//calculate the value of result as score.
$score +=$result
i want to this repeat calculate as long as i need...
but i need the $score will be change value to the next calculation.
example;
//first calculate
$score = 0
$result= 1
so $score +=$result = 0+1 = 1
//second calculation
$score=1 //come from first calculation
$result=1
=2
//third calculation
$score =2 //come from second calculation
$result=-1
=1
so how do i change the value of $score after calculation to be the total value
and bring it to the next operation.
please help me... i have try so many time but i don't, how to change it....
the value of $score do not change.....
thanks.....
this is my problem...
$score = 0;
//this is come form random choose by computer.
if(condition)
{
$result = 1;
}
elseif(condition)
{
$result = -1;
}
else
{
$result = 0;
}
//calculate the value of result as score.
$score +=$result
i want to this repeat calculate as long as i need...
but i need the $score will be change value to the next calculation.
example;
//first calculate
$score = 0
$result= 1
so $score +=$result = 0+1 = 1
//second calculation
$score=1 //come from first calculation
$result=1
=2
//third calculation
$score =2 //come from second calculation
$result=-1
=1
so how do i change the value of $score after calculation to be the total value
and bring it to the next operation.
please help me... i have try so many time but i don't, how to change it....
the value of $score do not change.....
thanks.....