Greetings. I have a file with this content:

$text = "a"; function MyFunc(){ $GLOBALS['text'] = "b"; } MyFunc(); include('путь'); 

It includes a file with such content:

 echo $text; 

It seems everything is logical. But it is not strange displays "a". How to fix it?

    1 answer 1

     $text = "a"; function MyFunc(){ global $text; $text = "b"; } MyFunc(); include('путь'); echo $text; 

    Try this

    • There is no difference. Here, only the approach is different. For with me we directly change the value from the array of global variables, and then first we take the global variable and then we change ^^. - Ram