dearmoawiz Posted April 15, 2008 Share Posted April 15, 2008 hi Guys i m new in php i want help regarding global variables or any other way to use variable globally ... here is the scenario!!!! i want to use a variable through out my application which have different folders and files as well ... if i change the value of a variable in one place then in whole application whenever i use that variable i must get the updated value of that variable ... waiting for your response .. Enjoy!!! Link to comment https://forums.phpfreaks.com/topic/101188-help-required-related-global-variable/ Share on other sites More sharing options...
kenrbnsn Posted April 15, 2008 Share Posted April 15, 2008 You want to look at using sessions In all the scripts where you want to share a variable, start your scripts with: <?php session_start(); ?> Where you want to set a variable, do <?php $_SESSION['var'] = 'some value'; ?> When you want to use it, do: <?php $var = $_SESSION['var']; // // or // echo $_SESSION['var']; ?> Ken Link to comment https://forums.phpfreaks.com/topic/101188-help-required-related-global-variable/#findComment-517586 Share on other sites More sharing options...
dearmoawiz Posted April 15, 2008 Author Share Posted April 15, 2008 thnxxx Buddy!!! Enjoy!!! Link to comment https://forums.phpfreaks.com/topic/101188-help-required-related-global-variable/#findComment-517623 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.