What are some alternative functions in PHP that can be used to truncate decimal numbers without rounding?

When truncating decimal numbers in PHP, the built-in round() function may not provide the desired result as it rounds the number to the nearest integer. To truncate decimal numbers without rounding, we can use alternative functions like floor() or intval().

// Truncate decimal number without rounding using floor() function
$number = 3.14159;
$truncatedNumber = floor($number);
echo $truncatedNumber; // Output: 3

// Truncate decimal number without rounding using intval() function
$number = 3.14159;
$truncatedNumber = intval($number);
echo $truncatedNumber; // Output: 3