Image

Imagertimmons wrote in Imagephp

quick help (again)

Hey. Sorry for the constant need of help, but I'm floundering again.

$cost is a variable that is a dollar amount. This script hooks up to the PayPal system and requires a cost to the hundreths place ($4.50, for example; not $4.5). The only possible tenths-place value is 5 (can't be $4.34; only $4.50 or $5.50 or whatever). How do I tell it to add a "0" on to the end of the variable but only if there isn't one already there? Any help would be great

So far, I have.. which only seems to be deleting the variable.

$cost = $tcost;
$tcost /= 2;
$costtype = gettype($tcost);
if ( $costtype != "integer" )
{
$cost == "$cost";
$cost += "0";
}

thanks