I'm new to try catch in php, and I was playing around with it.
when I try this one, it works fine
try {
if (!$connect)
{
throw new Exception("it's not working");
}
} catch (Exception $e) {
$e->getMessage();
}
When I try this one, it doesn't work
try {
if (!$connect) {
throw new MyException("it's not working");
}
} catch (MyException $e) {
echo $e->getMessage();
}
I have only changed the name of the exception, can someone explain where I went wrong pls. thanks