Trouble, number too long

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Trouble, number too long

Post by thiscatis »

For a shop i'm creating, i'm sending info to the paypal website to handle the payment.
I get my total shopping cart cost with this code:

Code: Select all

". $b->GetTotalPrice() . "
But this give numbers with more than 2 charachters after the " . " (e.g. , 2.1547)
Paypal doesn't support this and so it blocks the payment.
Is there a way to make sure only the 2 first numbers after the dot are displayed?
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

I'd suggest

Code: Select all

round
Post Reply