Forum Moderators: coopster
I have an array $test, the way $test was declared in file1.php:
$test = array();
and I set $test['value'] = "Josh".
I passed $test as a global to file2.php
However, when I do
$test['value'] = "Peter"
But if I do $db -> clear_cache()
then I can change the value of $test['value']
Could anyone tell me what the problem is?
I don't really want to do $db -> clear_cache()
Best Regards
Opiston
Thanks for helping.
Actually, I just realized that the value was written in. However, it changed back to the original value when the function is visited again.
For example:
function test() {
global $db, $test;
echo $test['value'];
//$db->clear_cache;
$test['value'] = "Peter";
echo $test['value'];
}
The first echo outputs Josh.
The second echo outputs Peter.
However, the next time I visit this function, the first echo outputs Josh instead of Peter.
But if I add that $db -> clear_cache; then the next time I vist the function test, the first echo will output Peter.
Best Regards
Opiston