php round down 1

php round down

// round down
echo floor(1.5); // prints 1

// round up
echo ceil(1.5); // prints 2

Here is what the above code is Doing:
1. We’re creating a variable called $number and assigning it the value of 1.5.
2. We’re using the round() function to round the number to the nearest integer.
3. We’re using the floor() function to round the number down to the nearest integer.
4. We’re using the ceil() function to round the number up to the nearest integer.

Similar Posts