Using if statement to check if a variable is zero
if ($bottom) { $result = $top / $bottom; } else { $ result = 0; }