ryan.od Posted November 16, 2006 Share Posted November 16, 2006 Imagine you have a file that includes a second file. If a variable is declared in the first file, can it be accessed in the second file? It seems to me a variable declared inside <?php ?> is not available outside of it.If this is true, how can I assign the root directory location to a variable in the index.php file and get to it in all the included files? I would rather not declare it in every file.Thanks.RyanOD Link to comment https://forums.phpfreaks.com/topic/27414-variables/ Share on other sites More sharing options...
tomfmason Posted November 16, 2006 Share Posted November 16, 2006 I seem to rember that I was able to decare a variable in one file and then use it in the current.All I can say is test it..Good Luck,Tom Link to comment https://forums.phpfreaks.com/topic/27414-variables/#findComment-125393 Share on other sites More sharing options...
ryan.od Posted November 16, 2006 Author Share Posted November 16, 2006 Right. That's what I've been doing. It seems to work fine in all included files. Guess I could have figured that out for myself. Sorry about that. Link to comment https://forums.phpfreaks.com/topic/27414-variables/#findComment-125399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.