Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert floating-point type into integer type in php
How to convert floating-point type into integer type in php
The conversion from floating point to integer has three functions.

1, floor (float value) rounding method is also called rounding, rounding decimal parts.

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

Echo? Floor (6.1); ? //The result is 6.

Echo? Floor (6.9); //The result is 6.

& gt2、ceil? Round in one way and round in a fractional part.

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

Echo? ceil(6. 1); ? //The result is 7

Echo? Upper limit (6.9); //The result is 7

& gt3. Rounded floating-point numbers are rounded.

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

Echo? round(6. 1); ? //The result is 6.

Echo? Circular (6.9); //The result is 7

& gt