> All variables in PHP are local to the scope in which it is defined. You 
> cannot declare a variable as global (as such). To use a global variable:

This is true.  But I believe that the original question was actually
the other way around...  Make a local variable into a global one.
The way to do that is this:


myFunc() {
  $myFuncLocalVar = "Hello!";

  echo $myFuncLocalVar;

  $GLOBALS[myFuncLocalVar] = $myFuncLocalVar;


echo $myFuncLocalVar;



PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to