Are there best practices for handling division operations in PHP to avoid errors like "Division by zero"?

When performing division operations in PHP, it is important to check if the divisor is zero to avoid errors like "Division by zero". One way to handle this is by using conditional statements to check if the divisor is zero before performing the division operation.

$dividend = 10;
$divisor = 0;

if($divisor != 0){
    $result = $dividend / $divisor;
    echo "Result: " . $result;
} else {
    echo "Error: Division by zero";
}