Are there any potential pitfalls or limitations when using the ceil function in PHP for rounding numbers?

When using the ceil function in PHP to round numbers, one potential pitfall is that it always rounds up to the nearest integer, which may not always be the desired behavior. To address this limitation, you can create a custom rounding function that allows you to specify the number of decimal places to round to.

function customCeil($number, $precision = 0) {
    $multiplier = 10 ** $precision;
    return ceil($number * $multiplier) / $multiplier;
}

// Example usage
$number = 3.14159;
$roundedNumber = customCeil($number, 2); // Rounds to 2 decimal places
echo $roundedNumber; // Output: 3.15