PHP global variables not working inside a function
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5912036/php-function-variable-scope">php function variable scope</a>  </p>
</blockquote>



<p>I am using below code to test with a global variable. It seems that a global variable cannot be compared inside a function.</p>

<p>Why is it not displaying 'hello world' in the output?</p>

<p>Below is the code that I am trying:</p>

<pre><code>&lt;?php    
$bool = 1;

function boo() {
    if ($bool == 1) {
        $bool = 2;
        echo 'Hello World';    
    }
}
?&gt; 
</code></pre>

<p>When I remove <code>function boo()</code>, 'hello world' is displayed. Why is it not displaying when function exists?</p>
