title: PHP variable scope within Try/Catch block
body: <p>In PHP, how do variable scope rules apply to Try/Catch blocks? Do variables declared within the <code>try</code> block go out of scope when the block has finished? Or are they in scope until the end of the function/method?</p>
  
  <p>For example:</p>
  
  <pre><code>try
  {
     // This may throw an exception when created!
     $o = new Pronk();
  }
  catch (Exception $ex)
  {
     // Handle &amp; exit somehow; not important here
     return false;
  }
  
  $o-&gt;doPronk();
  </code></pre>
  
  <p>Is this valid? Or should <code>$o = NULL;</code> be set before the try/catch to keep <code>$o</code> in scope?</p>
  
  <p>(I know that the sample code <em>does</em> work, however I also know PHP can get a little stupid when it comes to scoping. My question is, ideally, how <em>should</em> it work? What is the correct and proper way to do this?)</p>