Answer the question
In order to leave comments, you need to log in
Why does the function not see the global variable?
Snippet code for modx revo in PHP.
$a = 1; /* глобальная область видимости */
function Test()
{
global $a; /* Объявляем переменную $a глобальной */
echo $a; /* ссылка на переменную локальной области видимости */
}
Test();
Answer the question
In order to leave comments, you need to log in
Most likely, the snippet does not have a global context, you need to write global there too:
global $a;
$a = 1;
.... и т.д.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question