* Thus wrote Justin French:
> Jay,
> 
> "global $a, $b, $c" is used for bringing global variables INTO the 
> scope of the function... what I'm after is a way of making localised 
> variables (in function) available outside of the function.
 
<?php

$a = 1;

function foo() {
  global $a, $b;

  $a = 2;
  $b = 3;
}

echo $a, ':', $b, "\n";
foo();
echo $a, ':', $b, "\n";

results:
1:
2:3


remember 'global $a' is the same as doing:

  $a = &$GLOBALS['a'];



Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

Reply via email to