title: PHP Check if static variable has been declared or initialized?
body: <p>I want to check if a static variable has been declared/initialized previously, e.g. if a function with a static variable is being run for the first time. See the following example code:</p>
  
  <pre><code>function init_i (){
      // check if $i is set??
      if(isset($i)) echo '$i is static and is set ';
  
  
      static $i=0;
      $i++;
      echo "$i&lt;br&gt;";
  }
  
  function run_init(){
      init_i();
  }
  
  run_init(); //output 1
  run_init(); //should output $i is static and is set 2
  run_init(); //should output $i is static and is set 3
  run_init(); //should output $i is static and is set 4
  run_init(); //should output $i is static and is set 5
  </code></pre>
  
  <p>The problem is that isset($i) never seems to prove true even though it is a static variable.  How do I check <code>static $i</code> has already been set?</p>