Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global variables doesnt work #16

Closed
segovialucio opened this issue Oct 4, 2021 · 2 comments
Closed

Global variables doesnt work #16

segovialucio opened this issue Oct 4, 2021 · 2 comments

Comments

@segovialucio
Copy link

Hi, i dont know what happend but when i use routing, i cant use global variables. If i dump $GLOBALS, they doesnt show

@phprouter
Copy link
Owner

It does work

@harrisonratcliffe
Copy link

harrisonratcliffe commented Mar 7, 2022

I am also having issues with global variables. Can you show code as an example that it works @phprouter ?
Code:

$testVar = "testing";

function globVar() {
    global $testVar;
    echo $testVar;
}

globVar(); 

Output of var_dump($GLOBALS['testVar']);:
NULL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants