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? 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. 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 Link to comment https://forums.phpfreaks.com/topic/64518-solved-help-please-question/#findComment-321641 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.