include and require functions in PHP are not adding contents but not erroring out -


i'mu using codeigniter framework , have include_once('filename'); @ beginning of function. in stepping through code in debug mode caller function evaluates filename properly. can steps through file line line i'm attempting include. variables show i'm in included file properly, , exit out of include file , caller function has include_once() call, data gone , variables set in 'filename' uninitialized. possibly causing type of behavior?

maybe (i.e., surely) problem that, said, you're including file inside function. so, variables exist inside scope of function, , not outside of it.

you either declare variables global (which frowned upon), or better have function return values need variables of included file.

learn more on php variable scopes


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -