PHP Try Catch Exceptions how does it work
<p>I'm new to try catch in php, and I was playing around with it.</p>

<p>when I try this one, it works fine</p>

<pre><code>try {

    if (!$connect)
    {
        throw new Exception("it's not working");
    }
} catch (Exception $e) {
    $e-&gt;getMessage();
}           
</code></pre>

<p>When I try this one, it doesn't work</p>

<pre><code>try {       
    if (!$connect) {
        throw new MyException("it's not working");
    }       
} catch (MyException $e) {
    echo $e-&gt;getMessage();
}       
</code></pre>

<p>I have only changed the name of the exception, can someone explain where I went wrong pls.
thanks</p>
