php question
- Started
- Last post
- 5 Responses
- quamb
I'm a newb and stuck with some php for a shopping cart.
The below calls a price and spits it out. Though I need it to actually = "price + (price/10)"
Possible? Thanks in advance!
if($rsOptionvalue[$k]->fPrice>0)
{
$optName.="Text here".CONST_CURRENCY.number_form...
}
- Lillebo0
Clean thy code.
- Lillebo0
$price = 500;
$price = $price . " + " . ($price / 10);
// $price echoes "500 + 50"$price = 500;
$price = $price . " + (" . $price . "/10)";
// $price echoes "500 + (500/10)"
- quamb0
exactly.
Though need to incorporate it into the below.if($rsOptionvalue[$k]->fPrice>0)
{
$optName.="".CONST_CURRENCY.
number_format($rsOptionvalue[$k...
}
- quamb0
stupid keeps cutting off...
if($rsOptionvalue[$k]->fPrice>0)
{
$optName.="".CONST_CURRENCY.
number_format($rsOptionvalue
[$k]->fPrice,2);
}
- neverblink0
if(0 < $rsOptionvalue[$k]->fPrice){
// step 1; get Price (remove space before [$k])
$price = number_format($rsOptionvalue [$k]->fPrice, 2);
// step 2; add Price/10
$price = $price . " + (" . $price . "/10)";
// step 3; add currency
$price = CONST_CURRENCY . $price;
}