When should you use ceil function in PHP for rounding numbers?

When you need to round a number up to the nearest integer, you should use the ceil function in PHP. This is useful when you want to ensure that a number is always rounded up, even if the decimal part is less than 0.5. The ceil function rounds a number up to the nearest integer, regardless of the decimal part.

$number = 10.3;
$rounded_up = ceil($number);
echo $rounded_up; // Output: 11