see this code
it doesn't print anything
i want to access to $bar in this function and all functions but i dont want pass it by call ( foo($bar) ).
$bar="salam"; function foo() { echo $bar; } // ; foo();
anyone can help me thnaks
That's because the variable $bar is not avaiable within the function foo() Read up here on Globals
You script needs to look like this
$bar="salam"; function foo() { global $bar; echo $bar; } foo();