hmm..
i'm not quite sure what you expect the first function to do.... you're only printing out $test, which is "the problem is..."
firstly, declare global $test at the top of your function (ie. before you start assigning stuff to it)
secondly, you should be able to solve most (all?) problems without resorting to global variables anyway. Instead, pass all the variables you want using to the function, get the new values returned or just pass the variables by reference....
eg. pass by reference
function first_function($test) {
$test .= "Cheese";
}
function second_function($test) {
$test .= "'n'Chuff";
}
$stuff = "I like ";
first_function(&$stuff);
second_function(&$stuff);
echo $stuff;
displays "I like Cheese'n'Chuff"
alternatively you can return the value from the first function and give it to the second.
If you really want to use globals, then do it this way
function first_function() {
global $test;
... stuff to $test ...
}
function second_function() {
global $test;
... stuff to $test ...
}
then call the functions and $test will be globally changed.
hope this helps
dom
🙂