What are the potential pitfalls of using floor() to separate a decimal number in PHP?

Using floor() to separate a decimal number in PHP can result in the number being rounded down to the nearest whole number, which may not be the desired outcome. To accurately separate the integer and decimal parts of a number, you can use the floor() function in combination with the number itself and the modulo operator (%).

$number = 12.345;
$integerPart = floor($number);
$decimalPart = $number - $integerPart;

echo "Integer part: " . $integerPart . "<br>";
echo "Decimal part: " . $decimalPart;