Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
total adds to 3 decimal places, help.
Old 12-15-2007, 07:59 PM total adds to 3 decimal places, help.
Junior Talker

Posts: 3
Trades: 0
when the total of what is supposed to be added shows the total. It shows it with 3 decimal places, how do i get it to only be 2?
quiensave is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-15-2007, 08:50 PM Re: total adds to 3 decimal places, help.
Extreme Talker

Posts: 238
Location: United States
Trades: 0
You can round numbers in PHP to two decimal places by using:
PHP Code:
$num round($num2); 
If you want to just truncate to two decimal places, you can do:
PHP Code:
$num round($num-0.0052); 
__________________
The interlocking pieces of web development: usability, performance, accessibility, and standards.
frost is offline
Reply With Quote
View Public Profile
 
Old 12-17-2007, 06:08 AM Re: total adds to 3 decimal places, help.
Experienced Talker

Posts: 30
Trades: 0
PHP Code:
$num number_format($number2'.'','); 
klaroen is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to total adds to 3 decimal places, help.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26608 seconds with 12 queries