0

Access to a specific variable in 2seprate files

a variable(such as X) define in line 3 in index.php file.in line 5, i include another php file.Can i access the variable(X) into included file?

23rd Jan 2018, 9:49 AM
starbgram
starbgram - avatar
2 Réponses
+ 5
You can if you put the include "another.php" line after the line where the X variable is declared (in index.php), I assume index.php here includes another.php and not the other way around. Hth, cmiiw
23rd Jan 2018, 1:05 PM
Ipang
+ 1
Why do you upvote your own question haha But no you would have to include the index.php in this other file so it doesn't work
23rd Jan 2018, 10:02 AM
Jonas Geiler
Jonas Geiler - avatar