Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

RE: [PHP-DB] Currency and number types...
number_format() is what you need

look it up

bastien

>From: Mark Benson <markbenson@mac.com>
>To: php-db@lists.php.net
>Subject: [PHP-DB] Currency and number types...
>Date: Fri, 19 Nov 2004 17:35:53 +0000
>
>I'm trying to display data calculated by my script as a currency. The
>problem I have is that PHP is treating the results of the math as a 'float'
>number (or 'double') so I am getting results like:
>
>12.0594393
>
>in my table. I have tried using:
>
>print round($foobar,2)
>
>but that cuts off the trailing zero on numbers that comne out as, for
>example '12.10' or '12.00'.
>
>Does anyone know a way to force PHP to print numbers to a set number of
>significant figures (i.e. 2) and stop the trailing zero suppression?
>
>--
>Mark Benson
>
>http://homepage.mac.com/markbenson
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

Report this thread to moderator Post Follow-up to this message
Old Post
Bastien Koert
11-19-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:24 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.