frankiej Posted March 7, 2009 Share Posted March 7, 2009 I include a file using include_once in a function in another function i wish to get the variables previously included...but i can´t reach them even if i decalre the variabels using global: function func1() { include_once("some file"); return func2(); } function func2() { global $color; return $color; } Why? And how do i do that? Quote Link to comment https://forums.phpfreaks.com/topic/148404-solved-include_once-in-function/ Share on other sites More sharing options...
wildteen88 Posted March 7, 2009 Share Posted March 7, 2009 define $color as global in func1 maybe. Quote Link to comment https://forums.phpfreaks.com/topic/148404-solved-include_once-in-function/#findComment-779174 Share on other sites More sharing options...
Mark Baker Posted March 7, 2009 Share Posted March 7, 2009 Do the include outside of func1, and pass the values to the functions as parameters Quote Link to comment https://forums.phpfreaks.com/topic/148404-solved-include_once-in-function/#findComment-779180 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.