[PHP] functions and variables
-
hello, i have a function on my site that i need changed. how can i "save my changes" to $variable_2 for the whole script to access? i dont want to return an array. [code]function something( $variable ) { global $variable, $variable_2; $variable++; $variable_2++; return $variable; }[/code] thanks in advance, sam kline
-
hello, i have a function on my site that i need changed. how can i "save my changes" to $variable_2 for the whole script to access? i dont want to return an array. [code]function something( $variable ) { global $variable, $variable_2; $variable++; $variable_2++; return $variable; }[/code] thanks in advance, sam kline
Hi If you want use $variable_2 in other pages of your site you most register a session to use session you most call session_start() function then register your session variable like this
$_SESSION['variable_2'] = 1234;
then you can use $variable_2 in all pages that have session_start() function session_start() most call befor html codes & php functions that have output like echo & print Iman Ghasrfakhri -
Hi If you want use $variable_2 in other pages of your site you most register a session to use session you most call session_start() function then register your session variable like this
$_SESSION['variable_2'] = 1234;
then you can use $variable_2 in all pages that have session_start() function session_start() most call befor html codes & php functions that have output like echo & print Iman GhasrfakhriHi, I think session is hard to manage but yet if you can manage it then it is really good.
-------------------------------------------------------------------------------------------------- Hiral Shah India If you think that my answer is good enough and can be helpful for other then don't forget to vote. :)