PHP Exercise 5 / 15

Exceptions and Error Handling

Hard 30 points

Create a function that divides two numbers. Use try/catch to handle the exception if the divisor is 0.

PHP exceptions handle errors elegantly. try executes code, catch catches exceptions.

Well done! 🎉
Your answer is correct! You earned 30 points.
Your code PHP
Result