title: What is the performance impact off `get_defined_vars()`?
body: <p>Every so often I see questions on SO whose answers/solutions include the use of <code>get_defined_vars()</code>, or blog posts on the internet that use the method.  In most instances it is used for debugging purposes, but in some instances it seems as though the authors have the intention to use it in production code.</p>
  
  <p>While I rarely use the function because it makes me feel off inside, I was wondering what the actual performance impact of using this function was in a PHP application.</p>
  
  <p>One <a href="http://ideone.com/3hyrYX" rel="nofollow">example</a> of it's usage may be to see if a variable is explicitly set to <code>NULL</code>:</p>
  
  <pre><code>//$implicit_null = 1234;
  $explicit_null = NULL;
  
  var_dump(is_null($implicit_null)); // TRUE, also throws undefined index error
  var_dump((
      array_key_exists('implicit_null',get_defined_vars()) &amp;&amp; 
      is_null($implicit_null)
  )); // FALSE
  </code></pre>
  
  <p>There are other use-cases circulating on the internet, but very little outlining what the performance or memory impacts may be.</p>