PHP: declare variable with global scope from inside a function
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5355644/declaring-a-global-variable-inside-a-function">Declaring a global variable inside a function</a>  </p>
</blockquote>



<p>Is it possible to declare variable with global scope from inside a function?</p>

<p><strong>NOTE: I don't want to receive the value of a previously declared variable outside the function. But to have the values of the variables declared inside the function working outside the function scope.</strong></p>

<p>I a way that if I have these variables declared inside a function:</p>

<pre><code>function variables($n){
    $a=1+$n;
    $b="This is number +$n";
}
</code></pre>

<p>I could echo them outside the function:</p>

<pre><code>variables(1);
echo $a;
echo '\n';
echo $b;

2
This is number 1
</code></pre>

<p>I know I could achieve it returning an array from the function but... I'd like to be sure I could otherwise.</p>

<p>I saw nothing here: <a href="http://php.net/manual/en/language.variables.scope.php" rel="nofollow">http://php.net/manual/en/language.variables.scope.php</a></p>

<p>Thanks.</p>
