Forum Moderators: coopster
This is what I'm trying to do:
$userinfo['name'] = "bob";
$userinfo['lastname'] = "johnson";function displayinfo() {
echo $userinfo['name'] . " " . $userinfo['lastname'];
}
displayinfo();
Obviously this is a newbie question, but how do I set up my array so it can be accessed in the displayinfo() function?
Thanks
kevin
No, this isn`t the same. This is to do with variable scope. Variables declared outside a function are not the same as variables with the same name inside a function unless you pass the vars globally like in the example.
Superglobals on the other hand, such as $_GET,$_POST,$_COOKIE,$_SESSION are available anywhere in your script right throughout its execution. Same as constants.
This page should help:
[uk2.php.net...]
dc