PHP not recognising include variables.?
<php
include "test.php";
$GLOBAL["TEST"] = "FooBar"
?>
---------
test php
<?php
$test=$GLOBAL["TEST"];
echo $test
?>
DOES NOT WORK. Why lol?
Thanks everyone.
@Kevy spot on, the global was declared after the include thus the value was not passed.
@cpcii No thats all the code there is, the index.php and test.php.
@mathew, umm thanks for taking the time to reply.
I just wanted to see how many people actually understood code, and kevy certainly does :)
Ill post another question and deliberately not pass the variable to a function, resulting in the variable never being passed.