Jump to content

is there a way to add these as a number??


just me and php

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;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.