Gold Vision Communications / USA
 GOLDVISION.COM
Serving the Multimedia Community since 1989.
German Site | Spanish Site 

 Web Hosting

 Virtual Dedicated Servers

 Domaincheck

 Order

 Order Status

 Support

 Contact us

 Download

 Network

 Network Status

 Webdesign / Templates

 Make Payment

 Terms & Conditions

 Imprint

 Legal Notices

 Privacy Statement
  PHP / round
round

round

(PHP 3, PHP 4 >= 4.0.0)

round -- Rounds a float

Description

float round ( float val [, int precision])

Returns the rounded value of val to specified precision (number of digits after the decimal point). precision can also be negative or zero (default).

Caution

PHP doesn't handle strings like "12,300.2" correctly by default. See converting from strings.

$foo = round(3.4);  // $foo == 3.0
$foo = round(3.5);  // $foo == 4.0
$foo = round(3.6);  // $foo == 4.0
$foo = round(3.6, 0);  // equivalent with above

$foo = round(1.95583, 2);  // $foo == 1.96

$foo = round(1241757, -3);  // $foo == 1242000

Note: The precision parameter is only available in PHP 4.

See also ceil() and floor().


© 1998-2007 Gold Vision Communications All Rights Reserved.