🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: ba.php
Article #98

Re: Rounding

#98
From: Rod Apeldoorn
Date: Thu, 09 Nov 2000 00:00
23 lines
1391 bytes
"agent-blue" <agent_blue_17m@yahoo.co.uk> wrote in message
news:8u9i3s$jq3$1@plutonium.btinternet.com...
> I know you can use floor() to drop everything after the decimal point and
> ceil() to round 13.2  up to 14
> but how  can I get
>
> 2.8603515625  to be rounded to 2.86 ?

Hey Will,

Try the round function (good in PHP 3 and 4).

<?php
$num1 = 2.8603515625;
$num2 = round( $num1, 2);
echo $num2;
?>

http://www.php.net/manual/function.round.php

Rod Apeldoorn
rod@canowhoopass.com
http://www.canowhoopass.com/
Technical Details
Message-ID: <973803560.22270@news.islandnet.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8u9i3s$jq3$1@plutonium.btinternet.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10b1d3,8133919bc390d3b8
X-Google-Attributes: gid10b1d3,public
X-Google-Thread: 108904,8133919bc390d3b8
X-Google-Attributes: gid108904,public
X-Google-Thread: 10ce1c,8133919bc390d3b8
X-Google-Attributes: gid10ce1c,public
From: "Rod Apeldoorn" <rod@islandnet.com>
Subject: Re: Rounding
Date: 2000/11/09
Message-ID: <973803560.22270@news.islandnet.com>
X-Deja-AN: 691763858
References: <8u9i3s$jq3$1@plutonium.btinternet.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
X-Complaints-To: support@usenetserver.com
Organization: "Islandnet.com"
X-MSMail-Priority: Normal
NNTP-Posting-Date: Thu, 09 Nov 2000 16:10:41 EST
Newsgroups: ba.php,mailing.www.php-user,ufra.lists.php