Codecademy Forums

PHP Number Guessing

In the practice, values of global variables are updated, when the function runs. Is it because of global keyword? It does not use parameters and reference (&) on it. I thought I call copied values of variables in a function, and the original values are not changed.

Yes it is. We cannot update global variables without declaring that intention. We can access them without this formality, but not write to them.

1 Like