PHP coding challenge

Catching errors

āœØ Your Task

Have the divide method divide x by y and return the resulting value. In case an error is thrown, catch the error and return the error message.

āœļø PHP PHP version: 8.1
šŸ‘‰ Press "Run" and check the result below.
Test cases
Method divide should return 2 when dividing 10 by 5
Method divide should return Division by zero when dividing 10 by 0