-
Hi there!
I have the following code...
$string1 = 40.10;
$string2 = 0.70;
$holder = $string1 + $string2;
when I echo $holder, I get 40.8
Is there any way that I can keep the trailing "0" at the end so that it reads 40.80 ?
Thanks,
-
********* Callithumpian
If you are familiar with the C language functions of printf() and sprintf() then they work the same way in PHP.
If you are not (like me
) then use number_format()
http://us4.php.net/manual/en/function.number-format.php
echo number_format($holder, 2);
-
I looked for ages at PHP.net for a function that would do this. Can't have looked hard enough!
Thanks again freakysid, you're a star.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks