jaimitoc30 Posted October 19, 2007 Share Posted October 19, 2007 Hi, I have a little problem. I have a variables that is used inside a functions class. It is an internal variable for the function. I need to know how to access the value of that variable from my main problem, the function is already returning another value, so I need a way to read that value that is inside that function which is inside a class. I would appreciate any assistance. Link to comment https://forums.phpfreaks.com/topic/74008-php-global-variables/ Share on other sites More sharing options...
jaimitoc30 Posted October 19, 2007 Author Share Posted October 19, 2007 If I need to use a GLOBAL o PUBLIC variable, please let me know how and where I declare it. Thank you. Link to comment https://forums.phpfreaks.com/topic/74008-php-global-variables/#findComment-373564 Share on other sites More sharing options...
marcus Posted October 19, 2007 Share Posted October 19, 2007 $var = "hello"; function hello(){ echo $var; } hello(); # will not work $var = "hello"; function hello(){ global $var; echo $var; } hello(); # will work Link to comment https://forums.phpfreaks.com/topic/74008-php-global-variables/#findComment-373576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.