round

round -- Runden eines Wertes

Beschreibung

double round ( double val [, int precision])

Diese Funktion rundet den Eingabewert val auf precision Stellen nach dem Komma auf oder ab .

 
$foo

 
=

 
round

 
(

 
3.4)

 
;

 
/

 
/

 
$foo

 
==

 
3.0

 
$foo

 
=

 
round

 
(3.5)

 
;

 
/

 
/

 
$foo

 
==

 
4.0

 
$foo

 
=

 
round

 
(3.6)

 
;

 
/

 
/

 
$foo

 
==

 
4.0

 
$foo

 
=

 
round

 
(1.95583,2)

 
;

 
/

 
/

 
$foo

 
==

 
1.96





Anmerkung : Der Parameter precision ist nur in PHP 4 verfügbar.

Siehe auch ceil( ) und floor( ) .