Would anyone know how to resolve this scope problem? Or is this possibly something PHP can't (yet) do?


The problem is to access a variable in a function foo from a function local to foo.

- - -

function foo($var_foo)
  {
  $my_foo_local = 10;  //How can I reach this from inside function bar(...?

function bar($var_bar)
{
return $my_foo_local+$var_bar+1; // Doesn't work, can't see $my_foo_local
}


  return bar($var_foo)+1;
  }

if (foo(0)==12)
  echo "Yes! I did it!";
else
  echo "Nope. Sorry";

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



Reply via email to