balistic Posted August 12, 2007 Share Posted August 12, 2007 How do i use variables that were declared outside of a function, within a function i have written? everytime i try it, it doesnt seem to work is there a way? Quote Link to comment https://forums.phpfreaks.com/topic/64518-solved-help-please-question/ Share on other sites More sharing options...
Orio Posted August 12, 2007 Share Posted August 12, 2007 Lets say you want to be able to read/change the variable $var. Within the function, declare (in the beginning): global $var; This way $var will be referred as the variable $var in the global scope- meaning outside of the function. See more info here. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/64518-solved-help-please-question/#findComment-321596 Share on other sites More sharing options...
balistic Posted August 12, 2007 Author Share Posted August 12, 2007 prrrrfect thanks Quote Link to comment https://forums.phpfreaks.com/topic/64518-solved-help-please-question/#findComment-321641 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.