I am trying to save a variable and its value (e.g. $id = 1) across functions. The variable gets its value in Function1, and I would like to use the value in Function 2.
How can I do this? Thanks so much!
I am trying to save a variable and its value (e.g. $id = 1) across functions. The variable gets its value in Function1, and I would like to use the value in Function 2.
How can I do this? Thanks so much!
function one() {
global $id;
$id = 1;
}
function two() {
global $id;
echo $id;
}I didn't know you were supposed to declare a variable globally in the first function!
Thanks a lot :)
This topic has been closed to new replies.