I have 2 variables that should be global within its own file. I am attempting to access their set information from a function within that file but I receive nothing but an error. When I hardcode in the information into the function instead of retrieving from the variables, it works perfectly.
<?php
$myVar1 = "Suzy";
$myVar2 = "Billy";
function getNames()
{
$user1 = $myVar1;
$user2 = $myvar2;
return $user1 + $user2;
}
?>
This is similar to what I'm doing. $user1 and $user2 will have nothing in them when it reaches the return statement.
Could anyone help? I am able to access the variables when I include this file into another page, but just can't access them (maybe they aren't instantiated yet?) when I try to from this function.
Thanks!