Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution to the problem that php global variables can not be used in functions

Shulou Source: shulou.com Published: 2022-06-03 07:21:40 11月15日 Update

Php global variables can not be used in the function of the solution, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

1, use the global keyword to import global variables in the function, syntax "global global variable 1, global variable 2,...".

2. Use the hyperglobal variable "$GLOBALS" to access the specified global variable, with the syntax "$GLOBALS ['global variable name']".

The solution to the problem that php global variables cannot be used in the function is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Tags: Global variables functions methods questions more grammar help solutions easy easy keywords keywords content guys partners knowledge articles industries information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MySQL Xiaomi Docker Linux