Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2009, 09:12 AM
Authorized User
 
Join Date: Mar 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert decimal value as per requirement

Dear all,

I want to convert 99.678486 into 99.7 using php. Please provide sample code .

Thanks,
Thava
 
Old March 24th, 2009, 09:20 AM
Authorized User
 
Join Date: Mar 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default number formate

Dear all,

I found that solution from net. Here it is..

$number
= 1234.5678;

// english notation without thousands seperator
$english_format_number = number_format($number, 1, '.', '');
// 1234.6


Thanks,
Thava

 
Old April 6th, 2009, 02:58 AM
Authorized User
 
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Default

hello

round() will do the same for you

PHP Code:
echo round(99.6784862); 
 
Old April 6th, 2009, 04:29 AM
Authorized User
 
Join Date: Mar 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert decimal value as per requirement

Thanks anees.

Regards,
Thava





Similar Threads
Thread Thread Starter Forum Replies Last Post
Requirement base unit testing elliscnck Assembly Language 0 February 14th, 2008 10:32 AM
general question of how to implement a requirement gkelley Javascript How-To 0 July 27th, 2007 11:48 AM
decimal data type all 0's after decimal gobotsoup SQL Server ASP 1 February 28th, 2007 02:32 PM
urgent requirement geetha Visual Basic 2005 Basics 0 March 22nd, 2006 02:15 AM
Requirement for ASP .NET 2.0 rupen ASP.NET 2.0 Basics 7 October 21st, 2005 05:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.