title: How do I change a static variables value in PHP?
body: <p>This is a simplified version of what I want to accomplish:</p>
  
  <p>In my script I want a variable that changes true and false everytime the script is executed. </p>
  
  <pre><code>&lt;?php
      static $bool = true;
  
      // Print differente messages depending on $bool
      if( $bool == true )
          echo "It's true!";
      else
          echo "It's false!";
  
      // Change $bools value
      if( $bool == true )
          $bool = false
      else
          $bool = true;
  ?&gt;
  </code></pre>
  
  <p>But obviously what I'm doing is wrong. The variable <code>$bool</code> is constantly <code>true</code> and I haven't fully grasped the concept of static variables I presume. What am I doing wrong?</p>