What is the difference between the functions round(), ceil(), and number_format() in PHP when dealing with decimal numbers?
The functions round(), ceil(), and number_format() in PHP are used to manipulate decimal numbers in different ways. round() is used to round a number to the nearest integer, ceil() is used to round a number up to the nearest integer, and number_format() is used to format a number with grouped thousands and decimal points.
// Example of using round(), ceil(), and number_format() functions in PHP
$number = 12.3456;
// Round the number to the nearest integer
$roundedNumber = round($number);
echo "Rounded number: " . $roundedNumber . "\n";
// Round the number up to the nearest integer
$ceiledNumber = ceil($number);
echo "Ceiled number: " . $ceiledNumber . "\n";
// Format the number with grouped thousands and decimal points
$formattedNumber = number_format($number, 2);
echo "Formatted number: " . $formattedNumber . "\n";