Jump to content

Recommended Posts

Is there a way i can add these together and get the sum as a number

 

if($i==0){$f1000='100';}
if($i==1){$f1000='99';}
if($i==2){$f1000='98';}
if($i==3){$f1000='97';}
if($i==4){$f1000='96';}

if($i==0){$f2000='100';}
if($i==1){$f2000='99';}
if($i==2){$f2000='98';}
if($i==3){$f2000='97';}
if($i==4){$f2000='96';}

if($f1000=$i+$f2000=$i){$f3000='sum';}

 

echo "<td align=left bgcolor=$bgcolor id='title'><font face='Verdana' size='2'><font color='$fontcolormp'><B>$f3000</B></font></a></td>\n";

 

and i get sum as output but i want a number not sum

Link to comment
https://forums.phpfreaks.com/topic/38933-is-there-a-way-to-add-these-as-a-number/
Share on other sites

hmm ok the page outs a list as peeps post fast times list goes like this

 

this if statement makes up the points

if($i==0){$f1000='100';}

if($i==1){$f1000='99';}

if($i==2){$f1000='98';}

if($i==3){$f1000='97';}

if($i==4){$f1000='96';}

 

              points

1.blablabla 100

2.blablabla  99

3.blablabla  98

ect....

 

 

it also outputs total lap time

 

this if statement makes up the points for total time

if($i==0){$f2000='100';}

if($i==1){$f2000='99';}

if($i==2){$f2000='98';}

if($i==3){$f2000='97';}

if($i==4){$f2000='96';}

 

 

              points

1.blablabla 100

2.blablabla  99

3.blablabla  98

ect....

 

and yes this if statment makes no sence cause it dont work and im asking if there is a way to make it work

if($f1000=$i+$f2000=$i){$f3000='sum';}

 

so you take the 1. spot at top and added it to the number 1. spot at bottom and get 200 same as 2. 3. 4. 5. ect...

 

 

simple, but it should point you in the right direction.

 

$i = 0;
$f1000 = 0;
$f2000 = 0;

if($i == 0){
$f1000 = 100;
}elseif ($i == 1) {
$f1000 = 99;
}

if($i == 0){
$f2000 = 100;
}elseif ($i == 1) {
$f2000 = 99;
}

if(!empty($i)){
$sum = $f1000 + $f2000;
}

echo $sum;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.