title: Global variable handling
body: <p>While I'm trying to handle WARNING messages, I'm getting error for global variable/array (on last print_r line):</p>
  
  <blockquote>
    <p>Notice:  Undefined variable: errors in........</p>
  </blockquote>
  
  <p>I tried to declare <strong>$errors</strong> outside of function as well but same problem.</p>
  
  <p>Thanks</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>set_error_handler('validation_error_handler', E_WARNING);
  
  function validation_error_handler($error_no, $error_message)
  {
      global $errors;
      $errors[] = $error_message;
  }
  
  echo '&lt;pre&gt;'; print_r($errors); echo '&lt;/pre&gt;';
  </code></pre>