Who Stole My Zeros?!

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 22, 2008   (RSS)

By Perchpole - May 22, 2008

Here's a quickie for the mathematicians out there...

I'm using a record to perform a calculation that generates a simple product shipping cost. The calculation is the product weight multiplied by a fixed number. Something like this:

<?php echo $record['weight'] * 5 ?>




Although this works fine in practice (and can be used in systems like Paypal, etc.) the figures don't look right.

For example, instead of £2.50 what you see is £2.5!

Instead of £7.00 all you get is £7.

Simple question: How do I rework the code to display the missing zeros?!

:0o

Perch

Re: [Dave] Who Stole My Zeros?!

By Perchpole - May 22, 2008

Dave -

Seriously, you must stop eating that brainy food and give us mere mortals an opportunity to shine sometimes!

[tongue]

Thanks,

Perchpole