To make a round value from an decimal value like:
3.4 to 4
5.6 to 6
you can use the php ceil function, ceil - Round fractions down
its syntax is float ceil ( float
example
echo ceil(3.4); // 4
echo ceil(9.999); // 10
for a value Round fraction down you can use the floor()
example
echo floor(4.3); // 4
echo floor(9.999); // 9
echo floor(-3.14); // -4
and one is the round() function which returns the nearest round value to the decimal
echo round(3.4); // 3
echo round(3.5); // 4
echo round(3.6); // 4
echo round(3.6, 0); // 4
echo round(1.95583, 2); // 1.96
echo round(1241757, -3); // 1242000
echo round(5.045, 2); // 5.05
echo round(5.055, 2); // 5.06
for more detail or reference you can see the detail documentation on http://www.php.net/manual/en/function.round.php
posted by honeyonsys
3.4 to 4
5.6 to 6
you can use the php ceil function, ceil - Round fractions down
its syntax is float ceil ( float
$value
)example
echo ceil(3.4); // 4
echo ceil(9.999); // 10
for a value Round fraction down you can use the floor()
example
echo floor(4.3); // 4
echo floor(9.999); // 9
echo floor(-3.14); // -4
and one is the round() function which returns the nearest round value to the decimal
echo round(3.4); // 3
echo round(3.5); // 4
echo round(3.6); // 4
echo round(3.6, 0); // 4
echo round(1.95583, 2); // 1.96
echo round(1241757, -3); // 1242000
echo round(5.045, 2); // 5.05
echo round(5.055, 2); // 5.06
for more detail or reference you can see the detail documentation on http://www.php.net/manual/en/function.round.php
posted by honeyonsys
No comments:
Post a Comment