Question: Say I have...

```
function one($x){
     return $a + $x;
}

function two(){
     $a = 5;
     echo one(3);
}

```

Will this show the answer "8" or "3"? In other words, will function one get the value of $a or do I need to declare it global somewhere?

N.B. I haven't tried it yet, but I'm asking it here to understand WHY it acts one way or the other.

Answer: 
No function `one` does not know about `$a`. But this can be done.

```
$a = 5;

function one($x){
 global $a;
 return $a + $x;
}

function two(){
 global $a;
 $a = 5;
 echo one(3);
}

```

Now `two()` would echo `8`
Functions do not inherent scope from the function that calls them. (Nor do they inherit global variables by default - that's what the `global` keyword is for.)

Thus, `$a` will be completely undefined inside of `one()` and you'll get a notice about it.

For more details, see the [Variable Scope](http://us3.php.net/manual/en/language.variables.scope.php) page in the PHP manual.