Zaid Posted March 31, 2007 Share Posted March 31, 2007 what's the difference between including a file inside and outside a function? I want the variables of the included files to work directly without passing them again to the function my code is not working when the file is included inside the function e.g. <? function testing () { include( 'include/session.php' ); echo $session->username; } testing(); ?> any ideas? or suggestion to an alternative method? Link to comment https://forums.phpfreaks.com/topic/45043-including-a-file-within-a-function/ Share on other sites More sharing options...
kenrbnsn Posted March 31, 2007 Share Posted March 31, 2007 What's in the file "session.php"? Ken Link to comment https://forums.phpfreaks.com/topic/45043-including-a-file-within-a-function/#findComment-218670 Share on other sites More sharing options...
Zaid Posted March 31, 2007 Author Share Posted March 31, 2007 What's in the file "session.php"? Ken does that matter? just different variables and object variables Link to comment https://forums.phpfreaks.com/topic/45043-including-a-file-within-a-function/#findComment-218671 Share on other sites More sharing options...
kenrbnsn Posted March 31, 2007 Share Posted March 31, 2007 It might matter, depending on how they are defined. Ken Link to comment https://forums.phpfreaks.com/topic/45043-including-a-file-within-a-function/#findComment-218672 Share on other sites More sharing options...
Zaid Posted March 31, 2007 Author Share Posted March 31, 2007 It might matter, depending on how they are defined. Ken it is an opensource login system, nevermind don't waste your time reading it...thanks for the help. ill find another way. http://evolt.org/node/60384 Link to comment https://forums.phpfreaks.com/topic/45043-including-a-file-within-a-function/#findComment-218674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.