skinner927
10-09-2006, 04:14 AM
Ok, i may be thinking of Java or i may be wrong but can't you call arrays from inside functions without passing them in? Like this
$food['soup'] = "wet";
$foot['carrot'] = "hard";
function makeFood(){
... play with the arrays or whatever
}
doesn't that work? Or is there a way to pass in arays with out having to pass them in.... man its late, ha.
This is what i'm trying to do. I've setup my database variables in a file called conf.php and thers also a function in there called goDB(); goDB() connects to my database using the variables from the array in the file. I call goDB() from other files by importing conf.php into them. I want to be able to just call goDB() and dont worry about passing in the array.
Thanks for the help. Oh, and after thinking about it, no i was wrong, in Java arays are special because they don't create a copy of themselves in a function when passed in but you still need to pass them in, I belive PHP has the same rule. so I'm going at this wrong, obviously.
thanks for the help.
$food['soup'] = "wet";
$foot['carrot'] = "hard";
function makeFood(){
... play with the arrays or whatever
}
doesn't that work? Or is there a way to pass in arays with out having to pass them in.... man its late, ha.
This is what i'm trying to do. I've setup my database variables in a file called conf.php and thers also a function in there called goDB(); goDB() connects to my database using the variables from the array in the file. I call goDB() from other files by importing conf.php into them. I want to be able to just call goDB() and dont worry about passing in the array.
Thanks for the help. Oh, and after thinking about it, no i was wrong, in Java arays are special because they don't create a copy of themselves in a function when passed in but you still need to pass them in, I belive PHP has the same rule. so I'm going at this wrong, obviously.
thanks for the help.