title: PHP: working with functions storing array
body: <p>I have a</p>
  
  <pre><code>function displayErr(){
      $err[] = "You have an error";
  }
  </code></pre>
  
  <p>later in my code</p>
  
  <pre><code>if($bla==false) { displayErr(); }
  if(!empty($err)) { echo print_r($err); }
  </code></pre>
  
  <p>I don't get anything, can't I call a function that adds on <code>$err</code> and then check it later?</p>