View Single Post

  #3 (permalink)  
Old 09-05-2004
StinkFinger
 
Posts: n/a
Default Re: Adding discount script...

Thanks. I've reworked the code and came up w/this:

//$p is returned from a db like this 10.00
$np = number_format((intval($p) - (intval(date("j")) / 10)), 2);
echo $np; //returns 9.60 (for today)

I cannot figure out either how or why I would use round().
Can you provide an example ?
Thanks.

"Alvaro G. Vicario" <kAlvaroNOSPAMTHANKS@terra.es> wrote in message
news:ajh7z5rzrc7h$.v0nn7qif0pk0$.dlg@40tude.net...
> *** StinkFinger escribió/wrote (Sat, 4 Sep 2004 12:52:20 -0800):
>> $p = explode(".", $price); // $price is returned from the db in this
>> format
>> 10.00

>
> If you want to truncate the price just use (int)$price in your formula. I
> just wonder why you don't round().
>
> --
> --
> -+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
> +- http://www.demogracia.com (la web de humor para mayores de 100 años)
> ++ «Sonríe, que te vamos a hacer una foto para la esquela»
> --



Reply With Quote