+ 2

Use of global with two same variables

If I have $int1 = 56 outside of a function and $int1 = 89 inside the function. I then call echo global $int1 inside of the function. What will be displayed or will there be an error (explanation please if possible) Just asking.

2nd Jul 2016, 9:51 PM
Danila Fedotov
Danila Fedotov - avatar
2 ответов
+ 3
There wouldn't be an error. The value inside the function(89) will be printed as it is given higher precedence.
3rd Jul 2016, 4:04 AM
Midhun Mathew
0
According to the explanation it does not have to do with precedence(priority) but with scope(reach). 2 very different things.
14th Jul 2016, 6:16 PM
wkoeter