rondog Posted June 24, 2010 Share Posted June 24, 2010 I come from an actionscripting background so I am curious as to why this does not work in PHP? <?php $test = "testvar"; function runMe() { echo $test; //--- returns an undefined variable error } runMe(); ?> How would I go about making $test available to the runMe() method without passing it into the method itself? Quote Link to comment https://forums.phpfreaks.com/topic/205793-simple-explanation-needed-for-this/ Share on other sites More sharing options...
premiso Posted June 24, 2010 Share Posted June 24, 2010 http://www.php.net/manual/en/language.variables.scope.php Variable Scope is what you want to read up on. Quote Link to comment https://forums.phpfreaks.com/topic/205793-simple-explanation-needed-for-this/#findComment-1076898 Share on other sites More sharing options...
rondog Posted June 24, 2010 Author Share Posted June 24, 2010 excellent, thanks Quote Link to comment https://forums.phpfreaks.com/topic/205793-simple-explanation-needed-for-this/#findComment-1076918 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.