Local Scope
The local scope is the scope inside a function or method. The variables are contained within that scope, and are not available beyond it.
The opposite of local scope is the global scope.
<?php
function trumpet() {
// $trunk variable is only available in the trumpet scope
$trunk = 1;
$closure = function () {
// this scope is different from trumpet()
// its definition is nested in the trumpet() function
// but those are 2 distinct scopes
};
}
function forage() {
// $tusk variable is only available in the forage scope
$tusk = 1;
}
?>